Sie sind auf Seite 1von 2

Consider the following tables to solve Q.

 1
Class Students Class_fee Student_fee
cid Rollno cid Rollno
name cid fee Amount_paid
Name Date
Monitor

Student_attendence Subjects Results


Rollno Subid Rollno
Att_date name Term
status Subid
Marks
Notes:
• cid, rollno and subid are int fields and are primary keys of their respective tables
• Term is an int field with values 1, 2 or 3 for 1st, 2nd and 3rd terms
• Monitor is an int field that refers to rollno
• Status will be ‘A’ or ‘P’ or ‘L’

Q.1 Write the following queries: [30]


1. Sql statement to create results table
2. Drop date column from student_fee table and add pay_date column to it
3. Create a sequence for class table by the name CLASS_SEQ
4. Add class ‘Montessori’ to class table, cid value should come from sequence
5. Update marks of rollno 5 to 76 in 1st term for ‘english’
6. Delete student fee of rollno 8 paid on ’05­02­2011’
7. Display class names and their class monitor names
8. Display names of all those students who are not monitors
9. Display class name and the strength of each class
10. Display subject wise 1st term result of each student. Query should display student name, 
subject name, marks. Marks title should be 1st term result
11. Display average marks of each class in 1st and 2nd term
12. Display rollno and absents from ’01­01­2011’ to ’30­01­2011’ whose absents are more than 
9. Absents include ‘A’ and ‘L’ status
13. Display student name, fee due, fee paid and balance amount
14. update fee of all classes by 10%
15. make rollno, term and subid a composite key in results table
PTO

Q.2 Carefully read the case given below and answer the questions given at the end.

A retailer wants an automated system for his shop. He purchase products from different 
suppliers and records supplier, name, address and phone number of each supplier. He also 
records the product code, quantity purchased and cost per unit. On each sale he records product 
code, sale price per unit, quantity sold and type of sale. Type of sale is either cash or credit. In 
case of credit sale he records the client name, address and phone number.
1. Make tables to fulfill the above requirements [4]
2. Write sql query to show stock report [4]
Product  Quantity  Quantity  Stock in 
name purchased sold hand
3. Write sql query to show report of total revenue [3]
Total  Total  Profit/loss
purchases sales
4. Write sql query to show client names and his total amount receivable [3]
5. Write sql query to show total purchases from each supplier [3]
6. Write sql query to show total amount of cash and credit sales [3]

  GOOD LUCK 

Das könnte Ihnen auch gefallen