Page 188 - IT-802_class_12
P. 188

1006      NIRAJ                VII        85           9         14           1201
                      1005      RISHI                 X         89         NULL        17           1207

                      1003      ABHIJEET             XII        87          10         18           1206

              Write SQL commands for the following:
             i.  Create table in sql for the above details given.
             ii.  Insert all the details in the table as shown above.
             iii.  Set STUD_ID as the primary key.
             iv.  Show the description for the table.
             v.  Show all details of the student.
           2.  A cinema hall uses machines to sell tickets. The machine details and daily booked tickets information are stored in two tables
             namely Machine_Details and Tickets_Booked.
                                                Table Name: Machine Details
                                Field                                  Data Type

               Machine_ID                               CHAR (3)

               Station                                  CHAR (30)
                                                Table Name: Tickets_Booked

                                Field                                  Data Type

               Machine_ID                               CHAR (3)

               Date                                     DATE
               Tickets_Sold                             INTEGER

               Income                                   DECIMAL (10,2)

              Write SQL commands for the following:
             i.  Create the tables Machine_Details and Tickets_Booked.
             ii.  Set Machine_ID as the primary key.
             iii. Show the description for the table.
             iv. Write a query to find the total ticket machines in each station.
             vi.  Delete the student having TEACHER_ID as NULL.
             vii.  Alter the STUDENT table so that NULL values are not allowed for Age Column.
             viii. Write a query to display details of students whose marks are more than 80.
             ix.  Write a query to display the names of students who are not getting any bonus marks.
             x.  Write a query to display the id and name of the student whose name contains “T” as the last alphabet.
             xi.  Write a query to display the names and marks of the students whose teacher_id is 1206.
             xii.   Write a query to display the name and class of those students who are aged between 17 and 19 years (both inclusive).











          186   Touchpad Information Technology-XII
   183   184   185   186   187   188   189   190   191   192   193