0% found this document useful (0 votes)
7 views

O/p: 1 Row(s) Updated

SQL is a language used to manage and query databases. It allows users to perform operations like inserting, updating, deleting and selecting data from database tables. The document outlines the main SQL commands - INSERT adds new rows, UPDATE modifies rows, DELETE removes rows, SELECT retrieves rows, CREATE makes new tables, DROP removes tables, and ALTER changes table structures. Examples are provided for the syntax of each command.

Uploaded by

Arvind Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

O/p: 1 Row(s) Updated

SQL is a language used to manage and query databases. It allows users to perform operations like inserting, updating, deleting and selecting data from database tables. The document outlines the main SQL commands - INSERT adds new rows, UPDATE modifies rows, DELETE removes rows, SELECT retrieves rows, CREATE makes new tables, DROP removes tables, and ALTER changes table structures. Examples are provided for the syntax of each command.

Uploaded by

Arvind Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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