You are on page 1of 11

Session-2

Types of SQL commands:


DDL-data definition language
● Deals with the structure of database/table.
● Used to create modify the structure of database objects in the database/table.
● DDL is a set of commands used to create, modify and delete database structures but
not data.
● These commands are not used by general user.
CREATE, DROP, ALTER, TRUNCATE, COMMENT, RENAME
DML-data manipulation language
● Deals with manipulation of data present in database/table.
● It is a language used for inserting, deleting and updating data in a database/table.
INSERT, UPDATE, DELETE, LOCK
DCL-data control language
● Mainly deals with rights, permissions of the database.
● It is mainly used for revoke and to grant the user the required access to a database.
● It provides the administrators to remove and set database permissions to desired users
as needed.
GRANT, REVOKE
TCL-transaction control language
● Manages transactions within the database.
● It is used to execute changes made by DML statements.
BEGIN, COMMIT, ROLLBACK, SAVEPOINT
DQL-data query language
● Used to perform queries on the data.
● It includes the SELECT statement.
● SELECT is fired against tables
SELECT
DATATPYES:
● The data type of a column defines what value the column can hold: integer, character,
money, date and time, binary.
● Each column in a database table is required to have a name and a data type.
● In MySQL there are three main data types: string, numeric, and date and time.
STRING DATA TYPES
CHAR -Fixed length string-(0-255)
VARCHAR- varied length string(65535)
TINYBLOB
BLOB
TEXT
LONGTEXT
NUMERIC DATA TYPES
SMALLINT -(-32768 to 32767)
MEDIUMINT-(-8388608 to 8388607)
INT -(-2147483648 to 2147483647)
BIGINT -(-9223372036854775808 to 9223372036854775807)
FLOAT
DOUBLE
DATE & TIME
DATE - YYYY-MM-DD
DATETIME -YYYY-MM-DD hh:mm:ss
TIMESTAMP
TIME
YEAR

You might also like