O/p: 1 Row(s) Updated

You might also like

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

1. Whats SQL?

Its computer language that allows us to play with Database

Stands for Structural Query Langauge

2. Database: It is collection of tables.


3. Table: It is collection data arranged in rows/columns
4. INSERT, DELETE UPDATE, SELECT, DROP, ALTER, CREATE
5. INSERT COMMAND: Used to insert data rows into table
6. CREATE: Used to create table
7. DELETE: Used to Delete an entire row
8. UPDATE: To modify the content of table
9. DROP: To Delete the entire table
10. ALTER: To change the structure of the table

1. CREATE:
Syntax: Create table <Tablename> (Field1 Datatype1, Field2 Datatype2..
Field n Datatype n);
Eg: Create Table EMP(Name varchar2(10), Age integer, Salary Integer);
O/P: Table created.
2. INSERT:
Syntax: Insert Into <tablename> values ( Value1, Value2, ..Valuen);
Eg INSERT INTO EMP VALUES( rvind,20, 200);
O/P: 1 row(s) inserted.
3. UPDATE:
Sysntax: UPDATE <TableName> set <fieldname>=<New Value>
Eg: update emp set name=Mahantesh
Conditional Update:
Update emp set name=MahanteshWHERE Age=1;
o/p: 1 Row(s) Updated.
4. Delete:

Syntax: Delete from <Table name> WHERE <Condition>;

Eg: Delete from EMP where Age=1;

5. DROP:

Synatx: DROP Table <Tablename>;

Eg: Drop Table EMP;

O/p: Table dropped.


6. SELECT :
Used to select all/particular data from the table.
Synatx: Select * from <Table Name> Where <Confition>

Eg: Select * from EMP;


7. Select Age, Name from EMP where Name=rvind;

ALTER:

Syantx: ALTER TABLE <Tablename> modify < Column anme>

EG: ALTER TABLE EMP MODIFY NAME VARCHAR(10); DATATYPE CHANGED FROM VARCHAR2(10)
TO VARCHAR(10)

ALTER TABLE EMP RENAME COLUMN NAME TO FIRSTNAME;

O\P: table altered.


8. DESC: used to describe table
DESC <table anme>;
DESC EMP;

You might also like