SQL || Important Questions || Class 12 || Sumita-Arora || Preeti-Arora || Computer Science



Q. What is SQL? What are different categories of commands available in SQL?



Q. Differentiate between DDL and DML commands.




Q. Differentiate between CHAR and VARCHAR datatypes.



Q.
(a) Which key word is used to sort the records of a table in descending order?
(b) Which command is used to modify the records of the table?
(c) Which clause is used to remove the duplicate rows of the table?
(d) Differentiate between Primary key and Candidate key,
(e) Differentiate between Degree and Cardinality key.





Q.
(a) Write two examples of DBMS software.
(b) What is meant by NULL value in MySQL?
(c) Table 'Club' has 4 rows and 3 columns. Table 'Member' has 2 rows and 5 columns. What will be the cardinality of the Cartesian product of them?




Q. The SQL SELECT provides clauses for sorting data and for summarizing results. Write the names of clauses for these.




Q. What are aggregate functions? What is their use? Give some examples.



Q. What are different types of SQL functions?



Q. What is the significance of GROUP BY clause in a SQL query?



Q. What type of functions can you use with GROUP BY and HAVING clauses?



Q. What is the difference between a WHERE clause and a HAVING clause of SQL SELECT statement?



Q. Write a query to display details of employees who are not getting commission from table Empl.



Q. Write a query to display the difference of highest and lowest salary of each department having maximum salary > 4000.



Q. Insert all those records of table Accounts into table pending where amt_outstanding is more than 10000.



Q. Write a query to display the name of employee whose name contains 'M' as first alphabet 'L' as third alphabet.



Q. Write a query to display the name of employee whose name contains 'A' as third alphabet.
 


Q. Drop the column CustomerlncomeGroup from table Customer.



.

Q. Write a query that selects all orders (Order table) except those with zeros or NULLS in the amt field.




Q. Increase salary of employee records by 10% (table employee).



Q. Gopi Krishna is using a table Employee. It has the following columns:

Code, Name, Salary, Deptcode

He wants to display maximum salary department wise. He wrote the following command:

SELECT Deptcode, Max(Salary) FROM Employee ;

But he did not get the desired result.
Rewrite the above query with necessary changes to help him get the desired output.





Q. Show the average salary for all departments with more than 3 people for a job.




Q. Shanaya Khanna is using a table Employee. It has the following columns:

Admno, Name, Agg, Stream

[column Agg contains Aggregate marks]

She wants to display highest Agg obtained in each Stream.
She wrote the following statement:

SELECT Stream, MAX(Agg) FROM Employee ;

But she did not get the desired result. Rewrite the above query with necessary change to help get the desired output.






Q. Write a output for SQL queries (i) to (iii), which are based on the table: STUDENT given below:

Table: STUDENT

RollNo

Name

Class

DOB

Gender

City

Marks

1

Nanda

Ð¥

06-06-1995

M

Agra

551

2

Saurabh

XII

07-05-1993

M

Mumbai

462

3

Sanal

XI

06-05-1994

F

Delhi

400

4

Trisla

XII

08-08-1995

F

Mumbai

450

5

Stort

XII

08-10-1995

M

Delhi

369

6

Marisla

XI

12-12-1994

F

Dubai

250

7

Neha

Ð¥

08-12-1995

F

Moscow

377

8

Nishant

X

12-06-1995

M

Moscow

489



(i) SELECT COUNT(*), City FROM STUDENT GROUP BY CITY HAVING
(ii) SELECT MAX (DOB), MIN(DOB) FROM
(iii) SELECT NAME, GENDER FROM STUDENT WHERE CITY = "Delhi";





Q. Write SQL queries for (i) to (iv), which are based on the table: STUDENT given in the question 4(g):

(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".




Q. Find out number of employees having "Manager" as Job.



Q. Define the following terms: Field, Record, Table.



Q. What is a base table?



Q. What is NULL value?



Q. Differentiate between DROP and DELETE command.




Q. What are JOINS?



Q. How can you eliminate duplicate records in a table with select query?



Q. Define a Foreign Key.




Q. Define the various SQL Constraints.


Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post