Page 132 - CloudGPT_C8_Flipbook
P. 132

Info Hub: MYSQL
                                                                                                                                                         DOUBLE                  Specifies a double-precision floating point number

                                                                                                                                                         DATE                    Specifies a date value in YYYY-MM-DD format

                  MySQL is an open-source RDBMS software which is available free of cost.  It can run on various                                         TIME                    Specifies a time value in HH:MM:SS format
                  operating  systems,  including  Linux,  Unix  and  Windows.  It  uses  a  query  language  called  SQL                                 BOOL or BOOLEAN         Specifies a Boolean value

                  (Structured Query Language). SQL is a language that is used for managing relational databases and
                  performing various operations on the data in the tables. It is used to store, retrieve, and manipulate                    SQL Operators
                  data in the form of tables.                                                                                               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
                  Types of SQL Commands
                                                                                                                                            manipulate data, filter results, and perform calculations when querying a database.
                  SQL uses various commands to perform different operations on a database.
                                                                                                                                            Some commonly used operators in SQL are:
                  Data Definition Language (DDL)                                                                                                Arithmetic Operators: +, –, *, /, %

                  DDL commands define the structure of the database. Common DDL statements include CREATE,                                      Relational Operators: =,  !=, <>, <, >, <=, >=
                  ALTER, TRUNCATE, RENAME, and DROP.
                                                                                                                                                Logical Operators: ALL, AND, ANY, BETWEEN, NOT, OR, LIKE, IN, EXISTS
                  Data Manipulation Language (DML)
                                                                                                                                            CREATE DATABASE
                  DML commands modify data within the database. Common DML statements include SELECT, UPDATE,
                                                                                                                                            The CREATE DATABASE command is used to create a database in MySQL. The syntax to create a
                  INSERT INTO, and DELETE.
                                                                                                                                            database is:
                  Data Control Language (DCL)
                                                                                                                                                CREATE DATABASE database_name;
                  DCL commands grant and revoke permissions to database users. Common DCL statements include
                                                                                                                                            For example,
                  GRANT and REVOKE.
                                                                                                                                                CREATE DATABASE School;
                  Transaction Control Language (TCL)                                                                                        After  creating  a  database,  you  need  to  access  the  database  by  using  the  USE  command  in  the

                  TCL  commands  manage  database  transactions,  controlling  how  DML  changes  are  committed  or                        following way:
                  rolled back. Common TCL statements include COMMIT, SAVEPOINT, and ROLLBACK.                                                   USE School;

                  Data Types in SQL                                                                                                         CREATING A TABLE

                  A data type specifies the kind of data a column can store, such as INTEGER, VARCHAR, or DATE.                             As you know that a table is a collection of organised data in the form of rows and columns. It is also
                  Each column in a table must be assigned a data type to ensure data consistency and accuracy.                              known as a relation. The CREATE TABLE command is used to create a table in SQL.

                  Some of the data types in SQL are listed below:                                                                           The syntax to create a table is:

                                                                                                                                                CREATE TABLE table_name
                                    Data Type                             Description                                                           (

                                                                                                                                                column_name1 data_type (size),
                               CHAR                    Specifies a fixed length string
                                                                                                                                                column_name2 data_type (size),
                               VARCHAR                 Specifies a variable length string                                                       column_name3 data_type (size),

                                                                                                                                                .....
                               INT or INTEGER          Specifies an integer number
                                                                                                                                                .....
                               FLOAT                   Specifies a floating-point number                                                        column_nameN data_type (size)
                                                                                                                                                );

                      130    Premium Edition-VIII
   127   128   129   130   131   132   133   134   135   136   137