Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

INDEX

S.No. Practical Name Date of Date of Remarks


practical submission
1.

2.

3.

4.

5.

6.

7.

8.

9.

10.

11.

12.

13.
Experiment no.-1
AIM:- Introduction to sql and installation of oracle server.

SQL:- Structured Query Language (SQL) is the set of statements with which all programs and users
access data in an Oracle database. Application programs and Oracle tools often allow users access
to the database without using SQL directly, but these applications in turn must use SQL when
executing the user's request. This chapter provides background information on SQL as used by
most database systems.

Commands used in SQL Plus:-


CREATE:-
The CREATE TABLE statement is used to create a new table in a database.
Syntax:-
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
);

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

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

WHERE:-
The SQL WHERE Clause
The WHERE clause is used to filter records.
The WHERE clause is used to extract only those records that fulfill a specified condition.
WHERE Syntax
SELECT column1, column2, ...
FROM table_name
WHERE condition;

RENAME:-

RENAME command is used to set a new name for any existing table. Following is the syntax,
RENAME TABLE old_table_name to new_table_name
Here is an example explaining it.
RENAME TABLE student to students_info;
The above query will rename the table student to students_info.

ALTER:-
The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.
The ALTER TABLE statement is also used to add and drop various constraints on an existing table.
ALTER TABLE - ADD Column
To add a column in a table, use the following syntax:
ALTER TABLE table_name
ADD column_name datatype;

TRUNCATE :-

TRUNCATE command removes all the records from a table. But this command will not destroy the table's
structure. When we use TRUNCATE command on a table its (auto-increment) primary key is also
initialized. Following is its syntax,

TRUNCATE TABLE table_name

Here is an example explaining it,

TRUNCATE TABLE student;

The above query will delete all the records from the table student.

DELETE:-
DELETE command is used to delete data from a table.
Following is its general syntax,
DELETE FROM table_name;

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.
SELECT Syntax
SELECT column1, column2, ...
FROM table_name;

DESC:-
The DESC command is used to sort the data returned in descending order.
The following SQL statement selects all the columns from the "Customers" table, sorted
descending by the "CustomerName" column:
Example
SELECT * FROM Customers
ORDER BY CustomerName DESC;

DROP :-
The SQL DROP TABLE Statement
The DROP TABLE statement is used to drop an existing table in a database.
Syntax
DROP TABLE table_name;

You might also like