Page 176 - trackpad v5.1 class 8 flipbook
P. 176

Some of the data types in SQL are listed below:

                                     Data Type                            Description
                               CHAR                    Specifies a fixed length string

                               VARCHAR                 Specifies a variable length string
                               INT or INTEGER          Specifies an integer number
                               FLOAT                   Specifies a floating-point number

                                                       Specifies  a double-precision  floating  point
                               DOUBLE
                                                       number
                               DATE                    Specifies a date value in YYYY-MM-DD format
                               TIME                    Specifies a time value in HH:MM:SS format
                               BOOL or BOOLEAN         Specifies a Boolean value

                  SQL OPERATORS

                  An SQL operator is a reserved symbol or keyword used to perform specific tasks such as arithmetic
                  operations,  comparisons, and  logical  evaluations  within  SQL  queries.  Operators  allow you  to
                  manipulate data, filter results, and perform calculations when querying a database.
                  Some commonly used operators in SQL are:
                      Arithmetic Operators: +, –, *, /, %
                      Relational Operators: =,  !=, <>, <, >, <=, >=
                      Logical Operators: ALL, AND, ANY, BETWEEN, NOT, OR, LIKE, IN, EXISTS


                  CREATE DATABASE
                  The CREATE DATABASE command is used to create a database in MySQL. The syntax to create a
                  database is:

                      CREATE DATABASE database_name;
                  For example,
                      CREATE DATABASE School;
                  After creating a database, you need to access the database by using the USE command in the
                  following way:

                      USE School;
                  CREATING A TABLE

                  As you know that a table is a collection of organised data in the form of rows and columns. It is
                  also known as a relation. The CREATE TABLE command is used to create a table in SQL.

                  The syntax to create a table is:
                      CREATE TABLE table_name
                      (
                      column_name1 data_type (size),
                      column_name2 data_type (size),
                      column_name3 data_type (size),




                  174   Pro (V5.1)-VIII
   171   172   173   174   175   176   177   178   179   180   181