Sie sind auf Seite 1von 5

Experiment 21:

DDL Commands

Write SQL Commands to perform the following operations: 1. Create the tables as per the specifications given below. Table: CBSE (To store the details of the schools registered for the Olympiad conducted by CBSE) Column Name SAff SName Address Data Type Numeric(5) Varchar(20) Varchar(20) Constraints Primary Key Cannot be Null Description School Affiliation Code School Name Location of the School

Table: School (To store the students registered for the Olympiad in different classes) Column Name SAff Class MCount FCount Data Type Numeric(5) Numeric(3) Numeric(4) Numeric(4) Constraints Foreign Key of CBSE Table Only the Classes 8 or 10 or 12 Default Value 1 Default Value 1 Description School Affiliation Code Class Code No. of Male Students No. of Female Students

2. Add one more column in CBSE table to store the State Name in which the schools are located. 3. Increase the width of Address column in CBSE table up to 35 characters. 4. Rename the column Class in the School table to "CCode".

Experiment 22:

DML Commands

Write SQL Commands to perform the following operations: 1. Insert the following tuples in the tables "CBSE" and "School" CBSE: SAFF 14342 15642 11882 10967 School: SAFF 14342 14342 14342 15642 15642 11882 11882 11882 10967 10967 CCODE 8 10 12 8 10 8 10 12 10 12 MCOUNT 55 45 20 65 45 60 50 30 40 25 FCOUNT 45 40 20 60 45 50 45 30 30 20 SNAME St. Josephs AKM MJM RVPS ADDRESS Mumbai Chennai Guwahati Raipur STATENAME Maharashtra Tamil Nadu Chhattisgarh

2. Enter the State Name of the School Code 11882 as "Assam". 3. Increase the number of Male Students in Class Code 8 of the School Code 11882 by 5. 4. List the details of CBSE schools int the alphabetical order of the School Name. 5. List the School Affiliation Number and number of Male Students in Class Code 10 or 12 wherein the number of Female Students are less than or equal to 30. 6. List the details of the CBSE schools with School Name having the alphabet 'S'. 7. Change the Address of RVPS school to "MM Road, Raipur".

Experiment 23:

DML Commands (Grouping Tuples)

Write DML Commands to perform the following operations: 1. List the School Affiliation Code and the total number of Male Students in the school in each of the schools. 2. List the Class Code and the total number of students(both Male and Female together ) in each of the classes from the School Code. 3. Find the maximum, minimum and average number of Female Students in class 12(give meaningful names to the columns). 4. Find the total number of tuples in the table "CBSE". 5. List Affiliation Number(s) of the school(s) with total number of students less than 150.

Experiment 24:

DML Commands (Joins/Subquery)

Write DML Commands to perform the following operations: 1. Find the name of the school that has not registered Class 12. 2. List the School Name, State Name and the number of Male and Female Students registered from the School. 3. List the School Name and the number of Female Candidates registered in each school. 4. List the School Name, Class Codes of the schools with Affiliation Numbers 14342 and 10967. 5. Find the name of the school where maximum number of students have registered for the Olympiad.

Experiment 25:

DDL/DML Commands

Write DML Commands to perform the following operations: 1. List the schema/structure of both the tables. 2. Create a Virtual Table to store the School Affiliation Code, School Name, total number of Male Students and total number of Female Students in each of the school. 3. List all the details from the Virtual Table. 4. Increase the number of 10th Std. Female Students of MJM school by 10. 5. List Affiliation No., School Name, Class Code, Number of Male Students and Number of Female Students of MJM school. 6. List the MJM school details from the above Virtual Table.

Das könnte Ihnen auch gefallen