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 columns, whereas table constraints apply to groups of one or more columns.
Following are the few of database integrity constrains:
Unique constraint
Primary Key constraint
Default constraint
Check constraint
1. How do following constraint work?
(i) Unique
(ii) Primary Key
(iii) Default
(iv) Check
Unique: This constraint ensures that no two rows have the same value in the specified columns.
For eg , CREATE TABLE employee (ecode integer NOT NULL UNIQUE, ename char(20),Sex char(2) );
Primary Key: Primary key does not allow NULL value and Duplicate data in the column which is declared as
Primary Key.
For eg , CREATE TABLE employee (ecode integer NOT NULL PRIMARY KEY, ename char(20),Sexchar(2) );
Default: When a user does not enter a value for the column, automatically the defined default value is inserted in field. A column can have only one default value.
For eg , CREATE TABLE employee (ecode integer NOT NULL PRIMARY KEY, ename char(20), Sexchar(2), Grade char(2) DEFAULT = ‘E1’ );
Check: This constraint limits values that can inserted into a column of table.
For eg , CREATE TABLE employee (ecode integer NOT NULL PRIMARY KEY, ename char(20),Sex char(2) , Grade char(2) DEFAULT = ‘E1’, Gross decimal CHECK (gross > 2000 );
5.