Experiment No - 1 Implement DDL Commmand DDL:-: 1.create Command
Experiment No - 1 Implement DDL Commmand DDL:-: 1.create Command
Experiment No - 1 Implement DDL Commmand DDL:-: 1.create Command
1.CREATE COMMAND –
CREATE TABLE STUDENTS (Stud_Id number(10), Stud_Name
varchar(20),Stud_Age,number(5),Stud_College varchar(20));
DESC STUDENTS;
2.ALTER COMMAND –
ALTER TABLE STUDENTS ADD (City varchar(20));
DESC STUDENTS;
3.DROP COMMAND – It’s drop the table that me not show the table
EX :- DROP STUDENTS
NAME – SACHIN
ROLL NO. – 0173CS171029
EXPERIMENT NO -2
Implement DML Commmand
1.INSERT COMMAND –
INSERT INTO STUDENTS VALUES (101,’SACHIN’,19,’BIRT’,’BHOPAL’);
INSERT INTO STUDENTS VALUES (102,'NILESH',20,'BIRT','GUNA');
INSERT INTO STUDENTS VALUES (103,'MOHAN',18,'BIRTS','VIDISHA');
INSERT INTO STUDENTS VALUES (104,'NAYAN',21,'BIST','ITARSI');
2.UPADTE –
UPDATE STUDENTS SET Stud_AGE=23,City='MUMBAI' WHERE
Stud_Name='NILESH';
SELECT * FROM STUDENTS;
NAME – SACHIN
ROLL NO . -0173CS171029
EXPERIMENT NO -3
Implement DQL Commmand
DQL – DQL statement are used for performing queries on the data within
schema object.the purpose of DQL command is get some schema reletion based
on the query passed to it.
SELECT COMMAND –
SELECT STUD_ID ,STUD_NAME,STUD_AGE FROM STUDENTS;
NAME – SACHIN
ROLL NO. – 0173CS171029
EXPERIMENT NO -4
CREATE A DATA BASE AND SPECIFY PRIMARY KEY AND FOREIGN KEY
CREATE TABLE STUDENTS (Stud_Id number(10), Stud_Name
varchar(20),Stud_Age number(5),Stud_College varchar(20));
DESC STUDENTS
NAME – SACHIN
ROLL NO. – 0173CS171029
THIS TABLE HELP TO PERFORMING THE NEXT EXPERIMENT
CREATE TABLE Employee (name varchar(10) primary key(name), salary
number,age integer(10),Sex varchar(10));
INSERT INTO Employee VALUES ('Peter, 5000,12,'male');
INSERT INTO Employee VALUES ('John, 4000,21, ‘other’);
INSERT INTO Employee VALUES ('Sachin', 300000,20,’male’);
INSERT INTO Employee VALUES ('Yoyo', 40000,23,’male’);
INSERT INTO Employee VALUES ('Rehan', 1700,15,’male’);
INSERT INTO Employee VALUES ('Jackob', 7000,23,’male’);
INSERT INTO Employee VALUES ('Jacky', 17000,17,’male’);
INSERT INTO Employee VALUES ('Harmaini',34000,30,'female');
INSERT INTO Employee VALUES ('Charli', 4500,25,'male');
NAME – SACHIN
ROLL NO. – 0173CS171029
EXPERIMENT NO -6
IMPLEMENT AGGREGATE FUNCTIONS
1.SUM –
SELECT SUM(SALARY) AS PAYMENTS FROM EMPLOYEE;
2.MAX –
SELECT MAX(SALARY) AS PAYMENTS FROM EMPLOYEE;
3.MIN –
SELECT MIN(SALARY) AS PAYMENTS FROM EMPLOYEE;
4.AVERAGE –
SELECT AVG(SALARY) AS PAYMENTS FROM EMPLOYEE;
5.COUNT-
SELECT COUNT(*) FROM EMPLOYEE;
NAME – SACHIN
ROLL NO. -0713CS171029
EXPERIMENT NO -6
IMPLEMENTS ORDER BY ,BETWEEN,LIKE,GROUP BY ,HAVING
COMMAND.
1.ORDER BY –
SELECT * FROM EMPLOYEE ORDER BY SALARY DESC ;
2.LIKE –
SELECT NAME FROM EMPLOYEE WHERE NAME LIKE ‘%a’ ;
3.GROUP BY –
SELECT NAME FROM EMPLOYEE GROUP BY NAME;
4.HAVING –
SELECT NAME , AVG(SALARY) FROM EMPLOYEE GROUP BY NAME HAVING
AVG(SALARY)>3000;
NAME – SACHIN
ROLL NO. – 0173CS171029
EXPERIMENT NO -7
WRITE A QUERY TO DISPLAY ALTERNATE ROWS (ODD & EVEN)
1.ODD –
SELECT * FROM (SELECT name, salary, ROWNUM RN FROM Employee ORDER
BY name) WHERE MOD(RN, 2) <> 0 ;
NAME – SACHIN
ROLL NO. - 0173171029
EXPERIMENT NO -8
WRITE A QUERY TO UPDATE MULTIPLE RECORDS USING UPDATE
UPDATE Employee SET age= 26, sex = 'male', salary= 42000 WHERE
name = ‘John';
SELECT * FROM EMPLOYEE;
NAME -SACHIN
ROLL NO. – 0173CS171029
EXPERIMENT NO -9
WRITE A QUERY TO SELECT 3RD HIGHEST AND 3RD LOWEST SALARY
1. 3RD LOWEST SALARY -
SELECT name, salary FROM Employee e1 WHERE 3-1 = (SELECT COUNT(DISTINCT
salary) FROM Employee e2 WHERE e2.salary < e1.salary)
NAME – SACHIN
ROLL NO. – 0173CS171029
EXPERIMENT NO -10
WRITE A QUERY TO DISPLAY THE NAME WHICH START WITH
ALPHABATES G/g
SELECT NAME ,SEX FROM EMPLOYEE WHERE NAME LIKE '%G%';
NAME – SACHIN
ROLL NO. -0173CS171029