Dbms Week-1, 2
Dbms Week-1, 2
Syntax-
Create table tablename
(columnname datatype(size), columnname datatype(size));
Syntax-
CREATE TABLE TABLENAME(columnname data_type, columnname data_type,
………);
Example:
CREATE TABLE STUDENT(NAME VARCHAR2(17),ROLLNO VARCHAR2(7));
Insertion operation:
The insert command is used for inserting one or more rows into a database table
with specified table column values. The first DML command executed immediately
after a table creation is the insert statement.
Syntax-
INSERT INTO tablename [(columnname, columnname, ………)] values(expression,
expression);
Example:
INSERT INTO STUDENT[(NAME VARCHAR2(17),ROLLNO VARCHAR2(7))]
values(“Arjun”,”21131a1262”);
Syntax-
INSERT INTO tablename SELECT columnname, columnname…….. FROM
tablename WHERE columnname= expression;
Example:
Deletion Operation:-
A delete query is expressed in much the same way as Query. We can delete whole
tuple ( rows) we can delete values on only particulars attributes.
Syntax:
delete from tablename ;
Example:
Syntax:
Example:
Describe deposit:
desc deposit;
O/P:
List all data from table deposit:
Deletion of Table:
2 row(s) inserted.
1 row(s) deleted.
8 row(s) deleted.
Table truncated.
Table dropped.
WEEK-2 Date:
Aim: Data Manipulation Commands for updating and retrieving of data from Tables
and Transaction Control statements.
Description:
Data Manipulation Language(DML):
DML ( Data Manipulation Language) Data manipulation is
Syntax:
update table name
set columnname = expression, columnname =expression…… where columnname =
expression;
Syntax-
SELECT * FROM tablename;
Syntax-
SELECT columnname, columnname, …. FROM tablename;
Syntax-
SELECT DISTINCT columnname, columnname FROM tablename;
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
Find out the employee who does not belongs to ‘Baroda’ city.
SELECT * FROM employee WHERE CITY != ‘BARODA’;
Delete all the records of employee table having salary less than or equal to
14000.
DELETE FROM employee WHERE SALARY <= 14000;