Page 281 - PYTHON-12
P. 281

Table: boys                        Table: girls

               Rollno      Name                    Rollno     Name
                  1     Rohan                        6     Reema
                 12     Jayant                       10    Jaya
                  3     Tinku


              mysql> SELECT Name FROM boys WHERE

              Rollno < 12 UNION
              SELECT Name FROM girls WHERE Rollno > 6;
              The resultant table is:
                  Name
               Rohan
               Tinku
               Jaya

                mysql> SELECT Rollno,
                Name FROM boys

                UNION
              SELECT Rollno, Name FROM girls ORDER BY girls.name;
              The resultant table is:
               Rollno     Name
                 10    Jaya
                 12    Jayant
                 6     Reema
                 1     Rohan
                 3     Tinku




                 MEMORY BYTES
                  SQL is a language that is used to create, modify and access a database.
                  The various processing capabilities of SQL are Data Definition Language (DDL), Data Manipulation Language (DML)
                 and Data Control Language (DCL).
                  DDL is used to create and delete tables, views or indexes.
                  DML is used to modify and update the database.
                  DESCRIBE or DESC is used to show the structure of a table.
                  The SELECT statement is used to fetch data from one or more database tables.
                  SELECT * means display all columns.

                  The WHERE clause is used to select specific rows.
                  The DESCRIBE statement is used to see the structure of a table.
                  We can change the structure of a table, i.e., add, remove or change its column(s) using the ALTER TABLE statement.
                  The keyword DISTINCT is used to eliminate redundant data from display.                         Relational Database and SQL
                  Logical operators OR and AND are used to connect relational expressions in WHERE clause.
                  Logical operator NOT is used to negate a condition.



                                                                                                            12.51
   276   277   278   279   280   281   282   283   284   285   286