Professional Documents
Culture Documents
ASSIGNMENT DBMS
NAME: Farwa Mehmood Khan
Sublanguages Of SQL
DATE: 15-Jan-2021
Database:
Database, also called electronic database, any collection of data,
or information, that is specially organized for rapid search and retrieval
by a computer. Databases are structured to facilitate the storage,
retrieval, modification, and deletion of data in conjunction with various
data-processing operations. A database management system (DBMS)
extracts information from the database in response to queries.
Syntax:
Syntax:
Syntax:
Syntax:
CREATE DATABASE database_name;
database_name: name of the database.
Example Query:
This query will create a new database in SQL and name the
database as my_database.
CREATE DATABASE my_database;
Syntax:
Syntax:
DROP object object_name
Examples:
DROP TABLE table_name;
table_name: Name of the table to be deleted.
DROP DATABASE database_name;
database_name: Name of the database to be deleted.
Syntax:
TRUNCATE TABLE table_name;
table_name: Name of the table to be truncated.
5. RENAME:
Sometimes we may want to rename our table to give it a more
relevant name. For this purpose we can use ALTER TABLE to
rename the name of table.
Syntax:
ALTER TABLE table_name
RENAME TO new_table_name;
Example:
Syntax:
SELECT column1,column2 FROM table_name
column1 , column2: names of the fields of the table
table_name: from where we want to fetch.
Queries:
To fetch the entire table or all the fields in the table:
SELECT * FROM table_name;
Query to fetch the fields ROLL_NO, NAME, AGE from the table
Student:
SELECT ROLL_NO, NAME, AGE FROM Student;
Syntax:
COMMIT;
Queries:
DELETE FROM Student WHERE AGE = 20;
COMMIT;
Syntax:
ROLLBACK;
Queries:
DELETE FROM Student WHERE AGE = 20;
ROLLBACK;
Syntax:
SAVEPOINT SAVEPOINT_NAME;
ROLLBACK TO SAVEPOINT_NAME;