Solved MBA IT Assignment and Notes

Full width home advertisement

Post Page Advertisement [Top]

What is SQL? What are the types of SQL statements?
Answer:
SQL stands for Structured Query Language. It is a non-procedural language, meaning that SQL describes what data to retrieve, delete or insert, rather than how to perform the operation. It is the standard command set used to communicate with the RDBMS.

A SQL query is not-necessarily a question to the database.    It can be command to do one of the following.
•    Create or delete a table.
•    Insert, modify or delete rows.
•    Search several rows for specifying information and return the result in order.
•    Modify security information.

SQL statements are broadly of the following types:

1.  DDL(Data Definition Language)
2.  DML(Data Manipulation Language)
3.  DCL(Data Control Language)
4.  TCL(Transaction Control Language)


DDL: Data Definition Language
•    The DDL statement provides commands for defining relation schema i,e for creating tables, indexes, sequences etc. and commands for dropping, altering, renaming objects.
•    Some common statements are – CREATE, ALTER, DROP

CREATE
A CREATE statement in SQL creates an object inside of a relational database management system (RDBMS). To make a new database, table, index, or stored procedure.

ALTER
To modify an existing database object.
Eg: ALTER TABLE sink DROP COLUMN bubbles;

DROP
A DROP statement in SQL removes an object from a relational database management system (RDBMS).
Eg: DROP TABLE Employees;

DML: (Data Manipulation Language)
•    The DML statements are used to alter the database tables.
•    Some DML statements are – SELECT, UPDATE, INSERT and DELETE
•    They alter existing rows in a database tables, insert new records into a database table, or remove one or more records from the database table.

DCL: (Data Control Language)
•    The Data Control Language Statements are used to control access to data stored in a database.
•    Grant permission to the user and Revoke permission from the user, Lock certain Permission for the user.
•    Common commands under DCL: GRANT, REVOKE.

SQL DBA>Revoke Import from Akash;
SQL DBA>Grant all on emp to public;
SQL DBA>Grant select, Update on EMP to L.Suresh;
SQlDBA>Grant ALL on EMP to Akash with Grant option;

TCL: (Transaction Control Language)
•    It is used to control transactions.
•    A transaction is logical unit of work that comprises one or more SQL statements, usually a group of DML statements.
•    TCL commands include – COMMIT, ROLLBACK, SAVEPOINT

No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib