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

DBMS 2

Uploaded by

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

DBMS 2

Uploaded by

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

Experiment : 2

Aim : Queries to Retrieve and Change Data: Select, Insert, Delete and Update.

Description :
Select : The SELECT statement is used to select data from a database. The data returned
is stored in a result table, called the result-set.
Syntax :
SELECT column1, column2,
FROM table_name;

Here, column1, column2, ... are the field names of the table you want to select data from.
If you want to select all the fields available in the table, use the following syntax:
SELECT * FROM table_name;

We will be working on the table given below:

SELECT Columns
The following SQL statement selects the "deptno", "ename", and "job" columns from the
"empl" table:

selects the "deptno", "ename" columns from the "empl" table:

Reg. no.:
SELECT *
The following SQL statement selects ALL the columns from the "Customers" table:

The following SQL statement selects only ename from the "empl" table:

INSERT : The INSERT INTO statement is used to insert new records in a table.
It is possible to write the INSERT INTO statement in two ways:
Specify both the column names and the values to be inserted:
Syntax :
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);

If you are adding values for all the columns of the table, you do not need to specify the
column names in the SQL query. However, make sure the order of the values is in the
same order as the columns in the table. Here, the INSERT INTO syntax would be as
follows:
Syntax :
INSERT INTO table_name
VALUES (value1, value2, value3, ...);

Reg. no.:
Here is an example of inserting data into a table names empl:

UPDATE : The UPDATE statement is used to modify the existing records in a table.
Syntax :
UPDATE table_name
SET column1 = value1, column2 = value2,
WHERE condition;

We will be working on the above table named empl;

Reg. no.:
Reg. no.:
DELETE :
The DELETE statement is used to delete existing records in a table.
Syntax :
DELETE FROM table_name WHERE condition;

Note: Be careful when deleting records in a table! Notice the WHERE clause in the
DELETE statement. The WHERE clause specifies which record(s) should be deleted. If
you omit the WHERE clause, all records in the table will be deleted!

SQL> delete from empl where deptno=1;

1 row deleted.

Reg. no.:

You might also like