C++ :Sumita arora solutions for SQL chapter

4250 Words Nov 25th, 2013 17 Pages
1.
Ans.

2.
Ans.

3.
Ans.

4.
Ans.

Solved Exercise from Sumita Arora
STRUCTURED QUERY LANGUAGE
TYPE A : VERY SHORT ANSWER QUESTIONS

What is SQL? What are the various subdivisions of SQL?
SQL means Structured Query Language. It is the set of commands that is recognized by all RDBMS.
Data Definition Language (DDL)
Data Manipulation Language (DML)
Data Control Language (DCL)
Give examples of some DDL commands and some DML commands.
DDL Commands
1) CREATE
2) ALTER
3) DROP
DML Commands
1) INSERT INTO
2) DELETE
3) UPDATE
What is the difference between column constraint and table constraint? Name some database integrity constrains. The difference between column constraint and table constraint is that column constraint applies only to
individual
…show more content…
Ans.

What are views? When can a view be updated?
A view is, in essence, a virtual table. It does not physically exist. Rather, it is created by a query joining one or more tables.
In following condition a view can be updated :
 If it has only one base table.
 If select statement used in view contains group by clause then we cant update view.
What is the condition of dropping a table?

11.

Ans. There is a one condition for dropping a table that is a table must be an empty table which we want to drop.
Note: For the following questions consider the tables EMP given in book.
12.
Insert a record with suitable data in the table EMP, tabing system date as the Hiredate.
Ans. INSERT INTO emp VALUES
(1101,’ROBIN’,’CLERK',7902,curdate(),5000.00,500.00,10);
13.
To create a table DEPTO30 to hold the employee numbers, names, jobs and salaries of employee in department with DeptNo = 30.

CBSE CS N IP

Page 2 of 16

Ans.
14.
Ans.
15.
Ans.
16.
Ans.
17.
Ans.
18.
Ans.
19.

Ans.
20.
Ans.
21.
Ans.
22.
Ans.
23.
Ans.
24.
Ans.
25.
Ans.
26.
Ans.
27.
Ans.
28.
Ans.
29.
Ans.
30.
Ans.
31.
Ans.
32.
Ans.

CREATE TABLE DEPTP30 AS(SELECT EmpNo, EmpName, Job, Sal FROM EMP WHERE
DeptNo=30);
Display names all employees whose names include either of the substring “TH” or “LL”.
SELECT empname FROM emp WHERE(empname LIKE '%TH%' OR empname LIKE '%LL%');
Display data for all CLERKS who earn between 1000 and 2000.
SELECT * FROM emp WHERE((job LIKE 'clerk') AND (sal BETWEEN 1000 AND 2000));…

More about C++ :Sumita arora solutions for SQL chapter