CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

Querying and manipulating data (3 Marks Questions)


  1. Shewani has recently started working in MySQL. Help her in understanding the difference between the following :
    • Where and having clause
    • Count(column_name) and count(*)
  2. On the basis of following table answer the given questions:
    Table: CUSTOMER_DETAILS
    +---------+-----------+-----------+-------------+------------+--------+
    | Cust_ID | Cust_Name | Acct_Type | Accumlt_Amt |        DOJ | Gender |
    +---------+-----------+-----------+-------------+------------+--------+
    | CNR_001 |     Manoj |    Saving |      101250 | 1992-02-19 |      M |
    | CNR_002 |     Rahul |   Current |      132250 | 1998-01-11 |      M |
    | CNR_004 |     Steve |    Saving |       18200 | 1998-02-21 |      M |
    | CNR_005 |  Manpreet |   Current |        NULL | 1994-02-19 |      M |
    +---------+-----------+-----------+-------------+------------+--------+
    
    • Write the degree and cardinality of the above table.
    • What will be the output of the following query :
      Select max(DOJ) From Customer_Details;
    • Write the sql query to delete the row from the table where customer has no accumulated amount.
  3. Write the SQL commands for the i) to iv) on the basis of table TEACHER.
    Table:TEACHER
    No. Name Age Department Dateofadm Salary Sex
    1 Jugal 34 Computer 10-01-1997 12000 M
    2 Sharmila 31 History 24-03-1998 20000 F
    3 Sandeep 32 Maths 12-12-1996 30000 M
    4 Sangeeta 35 History 01-07-1999 40000 F
    5 Rakesh 42 Maths 05-09-1997 25000 M
    6 Shyam 50 History 37/06/98 30000 M
    7 Shivam 44 Computer 25-02-1997 21000 M
    8 Shalakha 33 Maths 31-07-1997 20000 F
    • i) To show all information about the teacher of History department.
    • ii) To display the list of all male teachers who are in Maths department.
    • iii) To display Names, Age and Sex of all teachers with their date of admission in descending order.
    • iv) To insert a new row in the TEACHER table with the following data:
      9,’Raja’, 26,’Computer’, {13/05/95}, 23000,’M’
  4. Write the output of the i) and iv) on the basis of table TEACHER given above
    • i) Selectelect COUNT(DISTINCT department) from TEACHER;
    • ii) Select MIN(Age) from TEACHER where SEX=’F’;
    • iii) SELECT COUNT(*) FROM teacher GROUP BY sex ;
    • iv) select * from teacher where Name like ‘S%’;

No comments:

Post a Comment