0% found this document useful (0 votes)
11 views5 pages

Manual Experiment 1.1

MY SQL COMMANDS, NOTES

Uploaded by

Sakshi Chib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

Manual Experiment 1.1

MY SQL COMMANDS, NOTES

Uploaded by

Sakshi Chib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Experiment:1.

1
Aim: To implement different types of DDL, DML, DCL queries.
S/W Requirement: Oracle Database Express Edition
Practical:
I. CREATE Command:
This command is used to create relations or tables. The column name must be specified along
the data types. Each table must have at least one column.
Syntax: Create table <tablename>(col1,datatype, col2,datatype…… coln,datatype);

So CT
II. DESCRIBE Command:
It is use to describe the table.It includes information like table name, column name, data type
etc.
Syntax: Describe <tablename>;

III. INSERT Command:


Records can be added to table using this command. Only one row can be inserted at a time.
Syntax: Insert into<tablename>(col1,col2…coln)values(List of values)
IV. SELECT Command:
This command is used to show table data.
Syntax: Select * from <tablename>;

This command is used to select specific columns.


Syntax: Select distinct col1,col2 from <table name>;

V. DELETE Command:
It is used to remove rows from a table. The entire row can be deleted using this command.
Syntax: Delete from<table name> where condition;
As shown here the row is deleted and table is shown in next figure.
ALTER Command
It is used to make changes in table. It can be used to add a new column or modify an existing
one. It is also used to delete a column.

Modification using alter command:

Delete a specific column using alter command.

VI. RENAME Command:


It is used to rename table.
Syntax: Rename old name to new name;
After rename the table is shown below.

VII. TRUNCATE Command


This command is used to remove all rows from the table and to release the storage space used
by that table.
Syntax: Truncate table <tablename>;

VIII. DROP Command


This command is used to remove the definition of a table. When you drop a table database
loses all the data in the table and all indexes associated with it.

IX. UNION Command


It is used to combine the data of one or more columns of two tables with same data type.
Syntax: Select <column name> from<tablename1> union all Select <column
name> from<tablename2>
X. MERGE Command
It is used to merge data of two distinct tables.
Syntax: Insert into <tablename1>(col1,col2) select col1,col2 from <tablename2>where
condition;

You might also like