Page 133 - CodePilot V5.0 C8
P. 133

PRIMARY KEY constraint: The Primary key constraint uniquely identifies each record in a table.
                    Primary keys must be unique, cannot be NULL and only one primary key can exists per table.

                     FOREIGN  KEY  constraint:  The  Foreign key  constraint  is used  to  establish a relationship
                    between two tables. It ensures that the values in a column in one table match the values in the
                    primary key column of another table.

                     UNIQUE constraint: The Unique constraint ensures that each value in a column is unique.
                     DEFAULT constraint: The Default constraint is used to specify a default value for a column.
                    If no other value is specified, the default value will be added to all new records.

                     CHECK constraint: The Check constraint restricts the range of values that can be stored in a
                    column by enforcing a specified condition.


                  RAPID RECALL                             Tick ( ) if you know this.


                     1.  Arithmetic operators perform basic mathematical operations on numerical data.

                     2.  DML is a language that enables users to retrieve, update, insert and delete data.








                        CREATING, VIEWING AND DELETING A DATABASE


                 Creating, viewing and deleting are basic database management tasks. They help set up new
                 databases, check existing ones and remove those that are no longer needed.

                 CREATING DATABASE

                 The CREATE DATABASE command is used to create a database in MySQL. Once the database is
                 created, you can begin adding tables, storing data and running queries.

                 The syntax to create a database is:

                 CREATE DATABASE database_name;
                 The command to create a School database is as follows:













                 VIEWING DATABASE
                 To view a list of existing databases, the following command is used:

                 SHOW DATABASES;




                                                                                                                  131
                                                                                          MySQL: My First Database
   128   129   130   131   132   133   134   135   136   137   138