You are on page 1of 2

1) Type of SQL commands?

These SQL commands are mainly categorized into four categories as discussed

DDL (Data Definition Language): it is use to create and manipulate different object in database.

I. CREATE
II. DROP
III. ALTER
IV. TRUNCATE
V. COMMENT
VI. RENAME

DML (Data Manipulation Language): it is use to manipulate data stored in database.

I. SELECT
II. INSERT
III. UPDATE
IV. DELETE

DCL (Data Control Language): it is used to control the access to different object stored in database.

I. GRANT
II. REVOKE

TCL (transaction Control Language) : After DML command is executed the updated data are not saving in
respective table to save data in respective table DCL command are used.

I. COMMIT
II. ROLLBACK
III. SAVEPOINT
IV. SET TRANSCATION.

2) Data types?
When we create table we must specify data type of each column this data type define the domain of
vale that each column can contain.

3) Char?
It is fixed character length. When values are stored in CHAR fields remaining chars will be padded with
white spaces.max size is 8000 bytes, mini is 1 byte. Length can be from 0 to 255.

4) VARCHAR?
VARCHAR will not add extra spaces to your data when you provide the less data then specific length.

5) NVARCHAR?

VARCHAR will not add extra spaces to your data when you provide the less data then specific length it
allow special character.
6) Different between delete, truncate and drop?
DELETE: it is a DML command, it deletes all particular records, data can be restored, and delete data
row by row, ROLLBACK is supported.

TRUNCATE: it is a DDL command, it deletes all records, data can’t be restored, and rollback is not
supported.

DROP: this operated is use to drop a single or multiple coloumn from database permanentaly ,rollback
is not supported .

SQL :

1) Emp records in asc of their sal?


SELECT * FROM EMP ORDER BY SAL;

2) Emp records in desc of their sal?


SELECT * FROM EMP ORDER BY SAL DESC;

3) Display EMP records working for 10th dep and arrange in asc order of their sal?

SELECT * FROM EMP WHERE DEP=10 ORDER BY SAL;

4) Display EMP records working for 10th dep and arrange in DESC order of their sal?
SELECT * FROM EMP WHERE SEPT =10 ORDER BY SAL DESC;

5)

You might also like