CBSE Class 12 Informatics Practices Database Query using Sql

Read and download free pdf of CBSE Class 12 Informatics Practices Database Query using Sql. Get printable school Assignments for Class 12 Informatics Practices. Class 12 students should practise questions and answers given here for Database Query using Sql Informatics Practices in Class 12 which will help them to strengthen their understanding of all important topics. Students should also download free pdf of Printable Worksheets for Class 12 Informatics Practices prepared as per the latest books and syllabus issued by NCERT, CBSE, KVS and do problems daily to score better marks in tests and examinations

Assignment for Class 12 Informatics Practices Database Query using Sql

Class 12 Informatics Practices students should refer to the following printable assignment in Pdf for Database Query using Sql in Class 12. This test paper with questions and answers for Class 12 Informatics Practices will be very useful for exams and help you to score good marks

Database Query using Sql Class 12 Informatics Practices Assignment

Question. What are different categories of commands in SQL?
Answer: 
i) Data Definition Language(DDL)
ii) Data Manipulation Language(DML)
iii) Transaction Control Language(TCL)
iv) Session Control Commands.
v) System Control Commands.

Question. What do you understand by Candidate Keys in a table? Give a suitable example of Candidate Keys from a table containing some meaningful data
Answer: 
Table:Item

CBSE-Class-12-Informatics-Practices-Database-Query-using-Sql

In the above table Item, ItemNo can be a candidate key

Question. A table Employee contains 5 Rows and 4 Columns and another table PROJECT contains 5 Rows and 3 Columns. How many rows and columns will be there if we obtain Cartesian product of these two tables?
Answer: Rows = 5 x 5 = 25
Columns = 4 + 3 = 7

Question. A table ‘Customers’ in a database has 5 columns and no rows in it. What is its degree and cardinality? Later on two columns were deleted from the table and 10 rows added in the table. What will be the new degree and cardinality?
Answer: Degree:- 5 and cardinality:-0.After changes Degree:- 3 and Cardinality :-10

Question. For the above given database STUDENT-PROJECT, can we perform the following operations?
(a) Insert a student record with missing roll number value.
(b) Insert a student record with missing registration number value.
(c) Insert a project detail without submission-date.
Insert a record with Registration_ID IP-101-19 and ProjectNo 206 in table PROJECT_ASSIGNED.

Answer: (a) No
(b) Yes
(c) Yes
(d) No, because ProjectNo 206 does not exist in PROJECT table.

Question. Database __________ which is the logical design of the database, and the database _________ which is snapshot of the data in the database at a given instant in time.
Answer: Schema, Instance

Question. STUDENT:

CBSE-Class-12-Informatics-Practices-Database-Query-using-Sql-1

For the given database STUDENT-PROJECT, answer the following:
(a) Name Primary key of each table.
(b) Find Foreign key(s) in table PROJECT-ASSIGNED.
(c) Is there any alternate key in table STUDENT? Give justification for your answer.
Can a user assign duplicate value to the field RollNo of STUDENT table? Justify
Answer: 
(a) STUDENT: Roll No
PROJECT: ProjectNo
PROJECT_ASSIGNED: Registration_ID
(b) PROJECTNO
(c) Name can be an alternate key as it stores unique values for each row.
(d) No, RollNo being the primary key must be unique for each row.

Question. For the above given database STUDENT-PROJECT, can we perform the following operations?
(d) Insert a student record with missing roll number value.
(e) Insert a student record with missing registration number value.
(f) Insert a project detail without submission-date.
(g) Insert a record with Registration_ID IP-101-19 and ProjectNo 206 in table PROJECT_ASSIGNED.

Answer: (e) No
(f) Yes
(g) Yes
(h) No, because ProjectNo 206 does not exist in PROJECT table.

 

TOPIC – SQL BASICS ( DDL AND DML COMMANDS)

PART A , Section I

Question. Which command is used to add new record in table?
Answer: INSERT INTO

Question. Which option of ORDER BY clause is used to arrange the output in descending order?
Answer: DESC

Question. Which command is used to change the existing information of table?
Answer: UPDATE

Question. Rajisadatabaseprogrammer,HehastowritethequeryfromEMPLOYEEtabletosearchfor the employee whose name begins from letter „R‟, for this he has written the query as: SELECT * FROM EMPLOYEE WHERENAME=‟R%‟;
Butthequeryisnotproducingthecorrectoutput,helpRajandcorrectthequerysothathe gets the desired output.
Answer:  SELECT * FROM EMPLOYEE WHERE NAME LIKE ‟R%‟;

Question. Rajisadatabaseprogrammer,HehastowritethequeryfromEMPLOYEEtabletosearchfor the employee who are not getting any commission, for this he has written the query as: SELECT * FROM EMPLOYEE WHEREcommission=null;
Butthequeryisnotproducingthecorrectoutput,helpRajandcorrectthequerysothathe
gets the desired output.

Answer: SELECT * FROM EMPLOYEE WHERE commission IS null;

Question. Rajisadatabaseprogrammer,hastowritethequeryfromEMPLOYEEtabletosearchforthe employeewhoareworkingin„Sales‟or„IT‟department,forthishehaswrittenthequeryas: SELECT*FROMEMPLOYEEWHEREdepartment=‟Sales‟or„IT‟;
Butthequeryisnotproducingthecorrectoutput,helpRajandcorrectthequerysothathe
gets the desired output.

Answer: SELECT*FROMEMPLOYEEWHEREdepartment=‟Sales‟ordepartment=„IT‟; OR
SELECT * FROM EMPLOYEE WHERE department IN (‘Sales’,’IT’)

Question. IfTableSalescontains5recordsandRajexecutedthefollowingqueries;findouttheoutput of both thequery.
(i) Select 100+200 fromdual;
(ii) Select 100+200 fromSales;

Answer: (i) 300
(ii) 300
300
300
300
300

Question. Query to delete all record of table without deleting the table:
a. DELETE TABLETABLE_NAME
b. DELETE FROMTABLE_NAME
c. DROP TABLETABLE_NAME
d. DELETE TABLE FROMTABLE_NAME
Answer: B

Question. Identify the wrong statement about UPDATE command
a. IfWHEREclauseismissingalltherecordintablewillbeupdated
b. OnlyonerecordcanbeupdatedatatimeusingWHEREclause
c. MultiplerecordscanbeupdatedatatimeusingWHEREclause
d. None of theabove
Answer: B

Question. Identify the correct statement(s) to drop a column from table
a. DELETE COLUMNCOLUMN_NAME
b. DROP COLUMNCOLUMN_NAME
c. ALTERTABLETABLE_NAMEDROPCOLUMNCOLUMN_NAME
d. ALTER TABLE TABLE_NAME DROPCOLUMN_NAME
Answer: C, D

Question. Sunil decides to delete a PhoneNo column from a MySQL Table (student) after insert the data into the table. Write the command to delete that particular column in student table
Answer: ALTER TABLE student drop PhoneNo

PART A , Section II

Question. Consider the following tables EMP and SALGRADE
Answer: 

CBSE-Class-12-Informatics-Practices-Database-Query-using-Sql-2

Question. To display details of all employee in descending order of their DOJ
Answer: 
SELECT * FROM EMPLOYEE ORDER BY DOJ DESC

Question. TodisplayNAME,DESIG,SGRADEofthoseemployeewhojoinedintheyear2009
Answer: 
SELECT NAME,DESIG,SGRADE FROM EMPLOYEE WHERE DOJ LIKE ‘2009%

Question. To display all SGRADE, ANNUAL_SALARY from table SALGRADE [where ANNUAL_SALARY = SALARY12]
Answer: 
SELECT SGRADE,SALARY12 ANNUAL_SALARY FROM SALGRADE

Question. To display number of employee working in each SALGRADE from table EMPLOYEE
Answer: 
SELECT SGRADE,COUNT(*) FROM EMPLOYEE GROUP BY SGRADE

Question. To display NAME, DESIG, SALARY, HRA from tables EMPLOYEE and SALGRADE
Answer: 
SELECT NAME,DESIG,SALARY,HRA FROM EMPLOYEE E,SALGRADE S WHERE

E.SGRADE=S.SGRADE AND SALARY<=50000
2. Give output for following SQL queries as per given table(s):

CBSE-Class-12-Informatics-Practices-Database-Query-using-Sql-3

Question. SELECT MIN (AVERAGE) FROM GRADUATE
WHERE SUBJECT = “PHYSICS”;
ii. SELECT SUM(STIPEND) FROM GRADUATE WHERE DIV = 2;
iii. SELECT AVG(STIPEND) FROM GRADUATE WHERE AVERAGE >= 65;
iv. SELECT COUNT (distinct SUBJECT) FROM GRADUATE;
v. Write code to rename a table in SQL

Answer: i. 55
ii. 1000
iii. 450
iv. 4
v. ALTER TABLE RENAME TO ;

PART B, Section I)

Question. (i) Sanjay was deleting the record of empno=1234, but at the time of execution of command he forgot to add condition empno=1234, what will be the effect of delete command in this case?
(ii) Sameer is executing the query to fetch the records of employee who are getting salary between 4000 to 8000, he executed the query as –
Select * from employee where salary between 4000 to 8000;
But he is not getting the correct output, Rewrite the correct query.

Answer: (i) If where clause is missing with DELETE then it will delete all the record of table.

Question. Select * from employee where salary between 40000 and 80000

CBSE-Class-12-Informatics-Practices-Database-Query-using-Sql-4

Answer: create table member(id char(6),name varchar(30),fee int(10),doj date)

Question. What is data redundancy? What are the problems associated with it?
Answer:
Data redundancy means duplication of data. It causes duplicate data at different locations which destroys the integrity of the database and wastage of storage space.

Question. What are referential Integrity Constraints? Describe them?
Answer:

CBSE-Class-12-Informatics-Practices-Database-Query-using-Sql-5

Question. Mr. Sanghi created two tables with City as Primary Key in Table1 and Foreign key in Table2 while inserting row in Table2 Mr Sanghi is not able to enter value in the column City. What is the possible reason for it?
Answer: Mr Sanghi was trying to enter the name of City in Table2 which is not present in
Table1 i.e. Referential Integrity ensures that value must exist in referred table.

PART B, Section II

(i) Write a query to display VisitorName, Coming From details of Female Visitors with Amount Paid more than 3000
(ii) Write a query to display all coming from location uniquely
(iii) Write a query to insert the following values- 7, „Shilpa‟,‟F‟,‟Lucknow‟,3000

Answer: (i) Select VisitorName,ComingFrom from Visitor
AmountPaid>3000
(ii) Select distinct ComingFrom from Visitor
(iii) insert into visitor values(7,’Shilpa’,’F’,’Lucknow’,3000)

Question. Create the following table

CBSE-Class-12-Informatics-Practices-Database-Query-using-Sql-7

Answer: Create table emp(empno integer Primary Key, Ename varchar(20) NOT NULL, job Char(10), mgr integer, hiredate date, saldecimal(9,2) check(sal>0),comm integer, deptno integer references dept(deptno) on delete cascade);

PART B, Section III

Question. Consider the following tables GAMES. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (vi)

CBSE-Class-12-Informatics-Practices-Database-Query-using-Sql-8

(i) To display the name of all Games with their Gcodes.
(ii) To display details of those games which are having PrizeMoney more than 7000.
(iii)To display the content of the GAMES table in ascending order of ScheduleDate.
(iv) To display sum of PrizeMoney for each of the Number of participation groupings (as shown in column Number 2 or 4).
(v) SELECT COUNT(DISTINCT Number) FROM GAMES;
(vi)SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM GAMES;

​​​​​​​Answer: (i) SELECT GameName,Gcode FROM GAMES;
(ii) SELECT * FROM GAMES WHERE PrizeMoney>7000;
(iii) SELECT * FROM GAMES ORDER BY ScheduleDate;
(iv) SELECT SUM(PrizeMoney),Number FROM GAMES GROUP BY Number;
(v) 2
(vi) 19-Mar-2004 12-Dec-2003

 

Consider the following tables STORE and SUPPLIERS and answer (a) and (b) parts of this question:

CBSE-Class-12-Informatics-Practices-Database-Query-using-Sql-9

Question. Write SQL commands for the following statements:
i. To display details of all the items in the STORE table in ascending order of LastBuy.
ii. To display ItemNo and Item name of those items from STORE table whose Rate is more than 15 Rupees.
iii. To display the details of those items whose supplier code (Scode) is 22 or Quantity in Store (Qty) is more than 110 from the table Store.
iv. To display minimum Rate of items for each supplier individually as per Scode from the table STORE.
Answer: A
i. select * from store order by lastbuy;
ii.selectitemno,item from store where rate>15;
iii. select * from store where scode=22 or qty>110;
iv. select min(rate),scode from store group by scode;

Question. Give the output of the following SQL queries:
i. SELECT COUNT(DISTINCT Scode) FROM STORE;
ii. SELECT Rate* Qty FROM STORE WHERE ItemNo = 2004;
iii. SELECT Item, Sname FROM STORE S, Suppliers P WHERE S.Scode= P.Scode AND ItemNo = 2006;
iv. SELECT MAX(LastBuy) FROM STORE;
Answer: B

CBSE-Class-12-Informatics-Practices-Database-Query-using-Sql-10

 

TOPIC – SQL QUERIES /FUNCTIONS

Question. Character can be stored as ____________.
a. Fixed length strings
b. Variable length strings
c. Either Fixed or Variable length strings
d. None of the above

Answer: C

Question. Query to delete all record of table without deleting the table:
a. DELETE TABLE <TABLE_NAME>;
b. DELETE FROM <TABLE_NAME>;
c. DROP TABLE <TABLE_NAME>;
d. DELETE FROM TABLE <TABLE_NAME>;

Answer: B

Question. Consider a situation where Ravi is assigned a task to see list of departments (Employee Table contain columns (EmpID, Name, Department, Salary, Age), when he executed the query as:
SELECT Department FROM Employee;
He noticed that the same department name is repeated multiple times in query output. What could be possible solution to get Department name uniquely? Rewrite the above query to fetch unique values
Answer: 
SELECT DISNTICT Department FROM Employee;

Question. The _________ function removes the leading extra spaces from the text.
a. Right( )
b. Trim ( )
c. Left ( )
d. Mid ( )

Answer: C

Question. What will be the output of the following:
SELECT ROUND(1449.58,-2);
a. 1449.58
b. 1449.00
c. 1400
d. 1449.60

Answer: C

Question. If table Sports contains 6 rows and you executes following query, then what will be the output?
SELECT 15+35 FROM Sports;

Answer: 15 + 35
50
50
50
50
50
50

Question. What is the minimum number of columns required to create table in mysql?
a. 0
b. 1
c. 2
d. None of the above

Answer: B

Question. What are two main characters used in pattern matching in MySQL?
a. % and –
b. % and _
c. % and x
d. x and  _

Answer: B

Question. Which aggregate function includes NULL values in their final result?
a. AVG ( )
b. MIN ( )
c. COUNT( )
d. COUNT ()

Answer: D

Question. Write SQL commands for the following on the basis of given table WORKER

CBSE-Class-12-Informatics-Practices-Database-Query-using-Sql-11

a. To display details of workers not working in HR and Account department.
b. To find names of workers that begins with V.
c. To retrieve the First Name and Last Name of Worker in single column as Full Name.
d. To find maximum salary of workers having joining between ‘2020-01-01’ and ‘2020-05-30’
e. To display Worker ID and number of years lapsed between Joining Date and Today.
Answer: 
a. SELECT * FROM worker WHERE Department NOT IN (‘HR’ , ‘Account’);
b. SELECT * FROM worker WHERE First_Name LIKE ‘V%’;
c. SELECT CONCAT(First_Name, “ “ , Last_Name) AS ‘Full Name’ FROM worker;
d. SELECT MAX(salary) AS “Maximum Salary” FROM worker WHERE Joining_Date BETWEEN ‘2020-01-01’ AND ‘2020-05-30’ ;
e. SELECT Worker_ID, YEAR(CURDATE() ) – YEAR (Joining_Date) FROM Worker;

Question. For the given table CLUB

CBSE-Class-12-Informatics-Practices-Database-Query-using-Sql-12

a To display bonus (10% of Pay) for all Female coaches
b To display details of club where sports contains word ‘ball’
c Display list of coaches with Pay more than 10000 and sorted by age.
d What will be output of below query?
SELECT AVG(Pay) FROM Club WHERE Age=36;
e. What will be output of below query?
SELEC T MIN(Age) FROM Club WHERE Pay>8000;
Answer: 
a.SELECT Pay*0.10 AS “BONUS” FROM Club WHERE SEX=’F’;
b. SELECT * FROM Club WHERE Sports LIKE ‘%ball%’;
c. SELECT Coachname, Pay FROM Club WHERE Pay >10000 order by Age;​​​​​

Class 12 Informatics Practices Assignments
CBSE Class 12 Informatics Practices Concept Of Inheritance In Java
CBSE Class 12 Informatics Practices Database Concepts Assignment
CBSE Class 12 Informatics Practices Database Query using Sql
CBSE Class 12 Informatics Practices Database Transactions Assignment
CBSE Class 12 Informatics Practices Extensible Markup Language Assignment
CBSE Class 12 Informatics Practices Free And Open Source Software Assignment
CBSE Class 12 Informatics Practices GUI Dialogs And Tables Assignment
CBSE Class 12 Informatics Practices HTML I Basic HTML Elements Assignment
CBSE Class 12 Informatics Practices HTML II Lists Tables and Forms Assignment
CBSE Class 12 Informatics Practices Introduction to Computer Networks Assignment
CBSE Class 12 Informatics Practices IT Applications Assignment
CBSE Class 12 Informatics Practices Java Database Connectivity To MySQL Assignment
CBSE Class 12 Informatics Practices Java GUI Programming Revision Tour Assignment
CBSE Class 12 Informatics Practices More About Classes And Libraries Assignment
CBSE Class 12 Informatics Practices More on SQL Grouping Records and Table Joins Assignment
CBSE Class 12 Informatics Practices More RDBMS Assignment
CBSE Class 12 Informatics Practices MYSQL Revision Tour Assignment
CBSE Class 12 Informatics Practices Networking and open standards Assignment
CBSE Class 12 Informatics Practices Programming Fundamentals Assignment
CBSE Class 12 Informatics Practices Revision Assignment Set A
CBSE Class 12 Informatics Practices Revision Assignment Set C
CBSE Class 12 Informatics Practices Revision Assignment Set D
CBSE Class 12 Informatics Practices Web Application Development Assignment
CBSE Class 12 Informatics Practices Worksheet All Chapters

CBSE Class 12 Informatics Practices Database Query using Sql Assignment

We hope you liked the above assignment for Database Query using Sql which has been designed as per the latest syllabus for Class 12 Informatics Practices released by CBSE. Students of Class 12 should download and practice the above Assignments for Class 12 Informatics Practices regularly. We have provided all types of questions like MCQs, short answer questions, objective questions and long answer questions in the Class 12 Informatics Practices practice sheet in Pdf. All questions have been designed for Informatics Practices by looking into the pattern of problems asked in previous year examinations. You can download all Revision notes for Class 12 Informatics Practices also absolutely free of cost. Lot of MCQ questions for Class 12 Informatics Practices have also been given in the worksheets and assignments for regular use. All study material for Class 12 Informatics Practices students have been given on studiestoday. We have also provided lot of Worksheets for Class 12 Informatics Practices which you can use to further make your self stronger in Informatics Practices.

What are benefits of doing Assignment for CBSE Class 12 Informatics Practices Database Query using Sql?

a. Score higher marks: Regular practice of Informatics Practices Class 12 Assignments for chapter Database Query using Sql will help to improve understanding and help in solving exam questions correctly.
b. As per CBSE pattern: All questions given above follow the latest Class 12 Informatics Practices Sample Papers so that students can prepare as per latest exam pattern.
c. Understand different question types: These assignments include MCQ Questions for Class 12 Informatics Practices with answers relating to Database Query using Sql, short answers, long answers, and also case studies.
d. Improve time management: Daily solving questions from Database Query using Sql within a set time will improve your speed and accuracy.
e. Boost confidence: Practicing multiple assignments and Class 12 Informatics Practices mock tests for Database Query using Sql reduces exam stress.

How to Solve CBSE Class 12 Informatics Practices Database Query using Sql Assignment effectively?

a. Start with Class 12 NCERT and syllabus topics: Always read the chapter carefully before attempting Assignment questions for Class 12 Informatics Practices Database Query using Sql.
b. Solve without checking answers: You should first attempt the assignment questions on Database Query using Sql yourself and then compare with provided solutions.
c. Use Class 12 worksheets and revision notes: Refer to NCERT Class 12 Informatics Practices worksheets, sample papers, and mock tests for extra practice.
d. Revise tricky topics: Focus on difficult concepts by solving Class 12 Informatics Practices MCQ Test.
e. Maintain notebook: Note down mistakes in Database Query using Sql assignment and read them in Revision notes for Class 12 Informatics Practices

How to practice CBSE Class 12 Informatics Practices Database Query using Sql Assignment for best results?

a. Solve assignments daily: Regular practice of Database Query using Sql questions will strengthen problem solving skills.
b.Use Class 12 study materials: Combine NCERT book for Class 12 Informatics Practices, mock tests, sample papers, and worksheets to get a complete preparation experience.
c. Set a timer: Practicing Class 12 Informatics Practices Database Query using Sql assignment under timed conditions improves speed and accuracy.

Where can I download in PDF assignments for CBSE Class 12 Informatics Practices Database Query using Sql

You can download free Pdf assignments for CBSE Class 12 Informatics Practices Database Query using Sql from StudiesToday.com

How many topics are covered in Database Query using Sql Informatics Practices assignments for Class 12

All topics given in Database Query using Sql Informatics Practices Class 12 Book for the current academic year have been covered in the given assignment

Is there any charge for this assignment for Database Query using Sql Informatics Practices Class 12

No, all Printable Assignments for Database Query using Sql Class 12 Informatics Practices have been given for free and can be downloaded in Pdf format

Are these assignments for Database Query using Sql Class 12 Informatics Practices designed as per CBSE curriculum?

Latest syllabus issued for current academic year by CBSE has been used to design assignments for Database Query using Sql Class 12

Are there solutions or answer keys for the Class 12 Informatics Practices Database Query using Sql assignments

Yes, we have provided detailed answers for all questions given in assignments for Database Query using Sql Class 12 Informatics Practices