0% found this document useful (0 votes)
27 views

CS Class 12 UT-ii

12 ut2 exam

Uploaded by

pgtcsjnvpta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

CS Class 12 UT-ii

12 ut2 exam

Uploaded by

pgtcsjnvpta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

JAWAHAR NAVODAYA VIDYALAYA, HATBARA,GANDERBAL

UT-2 EXAMINATION 2023-24

Subject: Computer Science Max Mark: 40

Class- XII Sc & Hum Duration: 90 minutes


SECTION-A

1. ______ command is used to remove primary key from the table in SQL.
(a) update (b)remove (c) alter (d)drop
2. Which of the following commands will delete the table from MYSQL database?
(a) DELETE TABLE (b) DROP TABLE (c) REMOVE TABLE (d) ALTER TABLE
3. _________ is a non-key attribute, whose values are derived from the primary key of
some other table.
(a) Primary Key (b) Foreign Key (c) Candidate Key (d) Alternate Key
4. Fill in the blank: The SELECT statement when combined with __________ clause, returns
records without repetition.
(a) DESCRIBE (b) UNIQUE (c) DISTINCT (d) NULL
5. Which function is used to display the total number of records from table in a database?
(a) sum(*) (b) total(*) (c) count(*) (d) return(*)
6. Which of the following is a DDL command?
a) SELECT b) ALTER c) INSERT d) UPDATE
7. Which of the following types of table constraints will prevent the entry of duplicate
rows?
a) Unique b) Distinct c) Primary Key d) NULL
8. Which of the following data types can store text values in MySQL?
a. INT b. FLOAT c. CHAR d. VARCHAR

9. Which of the following statements is used to insert data into a MySQL table?

a. SELECT b. UPDATE c. INSERT INTO d. DELETE

10. Which of the following clauses is used to sort the result set in ascending or
descending order in MySQL?

a. GROUP BY b. ORDER BY c. HAVING d. WHERE

SECTION-B
11.Categorize following commands into DDL and DML commands? INSERT INTO, DROP
TABLE, ALTER TABLE, UPDATE...SET 1
12.Write queries (a) to (d) based on the tables EMPLOYEE and DEPARTMENT given below:
2x4

(a) To display the average salary of all employees, department wise.


(b) To display name and respective department name of each employee whose salary is
more than 50000.
(c) To display the names of employees whose salary is not known, in alphabetical order?
(d) To display DEPTID from the table EMPLOYEE without repetition.
13.A table, ITEM has been created in a database with the following fields: ITEMCODE,
ITEMNAME, QTY, PRICE Give the SQL command to add a new field, DISCOUNT (of type
Integer) to the ITEM table. 1
14.Which command is used to view the list of tables in a database? 1
15.Write the output of the queries (a) to (d) based on the table, Furniture given below:

1x4
Table: FURNITURE
(a) SELECT SUM(DISCOUNT) FROM FURNITURE WHERE COST>15000;
(b) SELECT MAX(DATEOFPURCHASE) FROM FURNITURE;
(c) SELECT * FROM FURNITURE WHERE DISCOUNT>5 AND FID LIKE "T%";
(d) SELECT DATEOFPURCHASE FROM FURNITURE WHERE NAME IN ("Dining Table",
"Console Table");
16. Write the output of the queries (i) to (iv) based on the table, TECH_COURSE given
below: 1x4

(i) SELECT DISTINCT TID FROM TECH_COURSE;


(ii) SELECT TID, COUNT(*), MIN(FEES) FROM TECH_COURSE GROUP BY TID HAVING
COUNT(TID)>1;
(iii) SELECT CNAME FROM TECH_COURSE WHERE FEES>15000 ORDER BY CNAME;
(iv) SELECT AVG(FEES) FROM TECH_COURSE WHERE FEES BETWEEN 15000 AND
17000;

17. Write the outputs of the SQL queries (i) to (iv) based on the relations Teacher and
Placement given below: 1x4
(i) SELECT Department, avg(salary) FROM Teacher GROUP BY Department;
(ii) SELECT MAX(Date_of_Join),MIN(Date_of_Join) FROM Teacher;
(iii) SELECT Name, Salary, T.Department, Place FROM Teacher T, Placement P WHERE
T.Department = P.Department AND Salary>20000;
(iv) SELECT Name, Place FROM Teacher T, Placement P WHERE Gender =’F’ AND
T.Department=P.Department;

18. (a) Write SQL queries for (i) to (iv), which are based on the table: STUDENT 2x4

(i) To display the records from table student in alphabetical order as per the name of the
student.
(ii) To display Class, Dob and City whose marks is between 450 and 551.
(iii) To display Name, Class and total number of students who have secured more than 450
marks, class wise.
(iv) To increase marks of all students by 20 whose class is “XII”

(b) Write a output for SQL queries (i) to (iii), which are based on the above table: STUDENT 3

(i) SELECT COUNT(*), City FROM STUDENT GROUP BY CITY HAVING COUNT(*)>1;

(ii) SELECT MAX(DOB),MIN(DOB) FROM STUDENT;

(iii) SELECT NAME,GENDER FROM STUDENT WHERE CITY=”Delhi”;

You might also like