Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 134 - CodePilot V5.0 C8
P. 134

    QR QUEST

                                                                                                      Visit the given link
                                                                                              to learn about Constraints
                                                                                                       in SQL:
                                                                                            https://www.youtube.com/watch?v=-
                                                                                                     8bYtApJNos
                                                                                           Answer the given questions:

                                                                                           1.  Why are constraints important
                                                                                            in a database?
                                                                                           2.  Explain any two SQL
                                                                                             constraints.

                      USING DATABASE

                      To work with a specific database, you must first select it using the
                      USE command. The syntax is as follows:

                      USE database_name;

                      DELETING DATABASE

                      If  you  no longer need  a database,  you  can delete  it.  However, this  action  is  permanent  and
                      removes all tables and data within the database. Always ensure that you have a backup before
                      deleting a database.

                      The syntax to delete a database is:

                      DROP DATABASE database_name;

                             CREATING AND MANAGING TABLES

                      In  MySQL, tables  are the fundamental  building blocks  of a database  for storing  data  in an
                      organised mannner. Table management involves creating, viewing, modifying and deleting these
                      structures as needed.

                      CREATING TABLES
                      A table, also known as a relation, organizes data into rows and columns. To create one, you use
                      the CREATE TABLE command. The syntax is as follows:

                      CREATE TABLE table_name
                      (
                      column_name1 data_type(size),

                      column_name2 data_type(size),
                      column_name3 data_type(size),
                      .....

                       132
                            CodePilot (V5.0)-VIII

| 129 130 131 132 133 134 135 136 137 138 139 |