Pages
- Home
- Data Structure book & DBMS notes
- SQL example
- Lab Manual for B.C.A & B.Tech
- Question Bank
- Data Structure Program
- Question Paper format for Sessional Exam
- Books
- ePaper & Times ascent epaper
- B. Tech(CS 2nd Year)
- Question Bank for CSE 2nd Year
- B.C.A Notes
- B.Tech CSE 2nd Year Notes
- C Programming Video Lecture
- Compiler Design Lab
- Logic in Computer Science
- Data Structure Algorithm Video Lecture
- Notes Unit 1
- Notes Unit 2
- Notes Unit 3
- Notes Unit 5
- Notes Unit 4
- SQL Notes
- Linked List
Sunday, January 21, 2018
Thursday, January 11, 2018
SQL
DROP TABLE IF EXISTS emp;
CREATE TABLE emp(eid integer,ename varchar(20),sal integer,ecountry varchar(200));
INSERT INTO emp VALUES (1,'XYZ',20000,'INDIA');
INSERT INTO emp VALUES (2,'XYZ1',2000,'ENGLAND');
INSERT INTO emp VALUES (3,'XYZ2',2000,'INDIA');
INSERT INTO emp VALUES (4,'XYZ3',20000,'ENGLAND');
INSERT INTO emp VALUES (5,'XYZ4',20000 ,'RUSSIA');
INSERT INTO emp VALUES (6,'XYZ5',20000 ,'SRI LANKA');
SELECT * FROM emp;
SELECT * FROM emp WHERE eid=1;
SELECT * FROM emp WHERE ename='XYZ5';
SELECT eid,ename FROM emp;
SELECT * FROM emp WHERE sal<10000;
SELECT DISTINCT ecountry FROM emp;
SELECT DISTINCT ename FROM emp;
SELECT COUNT(DISTINCT ecountry) FROM emp;
SELECT COUNT(DISTINCT ename) FROM emp;
SELECT * FROM emp WHERE ecountry='INDIA';
DROP TABLE IF EXISTS emp;
CREATE TABLE emp(eid integer,ename varchar(20),sal integer,ecountry varchar(200));
INSERT INTO emp VALUES (1,'XYZ',20000,'INDIA');
INSERT INTO emp VALUES (2,'XYZ1',2000,'ENGLAND');
INSERT INTO emp VALUES (3,'XYZ2',2000,'INDIA');
INSERT INTO emp VALUES (4,'XYZ3',20000,'ENGLAND');
INSERT INTO emp VALUES (5,'XYZ4',20000 ,'RUSSIA');
INSERT INTO emp VALUES (6,'XYZ5',20000 ,'SRI LANKA');
SELECT * FROM emp;
SELECT * FROM emp WHERE eid=1;
SELECT * FROM emp WHERE ename='XYZ5';
SELECT eid,ename FROM emp;
SELECT * FROM emp WHERE sal<10000;
SELECT DISTINCT ecountry FROM emp;
SELECT DISTINCT ename FROM emp;
SELECT COUNT(DISTINCT ecountry) FROM emp;
SELECT COUNT(DISTINCT ename) FROM emp;
SELECT * FROM emp WHERE ecountry='INDIA';
OUTPUT:
CREATE TABLE emp(eid integer,ename varchar(20),sal integer,ecountry varchar(200));
INSERT INTO emp VALUES (1,'XYZ',20000,'INDIA');
INSERT INTO emp VALUES (2,'XYZ1',2000,'ENGLAND');
INSERT INTO emp VALUES (3,'XYZ2',2000,'INDIA');
INSERT INTO emp VALUES (4,'XYZ3',20000,'ENGLAND');
INSERT INTO emp VALUES (5,'XYZ4',20000 ,'RUSSIA');
INSERT INTO emp VALUES (6,'XYZ5',20000 ,'SRI LANKA');
SELECT * FROM emp;
SELECT * FROM emp WHERE eid=1;
SELECT * FROM emp WHERE ename='XYZ5';
SELECT eid,ename FROM emp;
SELECT * FROM emp WHERE sal<10000;
SELECT DISTINCT ecountry FROM emp;
SELECT DISTINCT ename FROM emp;
SELECT COUNT(DISTINCT ecountry) FROM emp;
SELECT COUNT(DISTINCT ename) FROM emp;
SELECT * FROM emp WHERE ecountry='INDIA';
DROP TABLE IF EXISTS emp;
CREATE TABLE emp(eid integer,ename varchar(20),sal integer,ecountry varchar(200));
INSERT INTO emp VALUES (1,'XYZ',20000,'INDIA');
INSERT INTO emp VALUES (2,'XYZ1',2000,'ENGLAND');
INSERT INTO emp VALUES (3,'XYZ2',2000,'INDIA');
INSERT INTO emp VALUES (4,'XYZ3',20000,'ENGLAND');
INSERT INTO emp VALUES (5,'XYZ4',20000 ,'RUSSIA');
INSERT INTO emp VALUES (6,'XYZ5',20000 ,'SRI LANKA');
SELECT * FROM emp;
SELECT * FROM emp WHERE eid=1;
SELECT * FROM emp WHERE ename='XYZ5';
SELECT eid,ename FROM emp;
SELECT * FROM emp WHERE sal<10000;
SELECT DISTINCT ecountry FROM emp;
SELECT DISTINCT ename FROM emp;
SELECT COUNT(DISTINCT ecountry) FROM emp;
SELECT COUNT(DISTINCT ename) FROM emp;
SELECT * FROM emp WHERE ecountry='INDIA';
OUTPUT:
eid | ename | sal | ecountry |
---|---|---|---|
1 | XYZ | 20000 | INDIA |
2 | XYZ1 | 2000 | ENGLAND |
3 | XYZ2 | 2000 | INDIA |
4 | XYZ3 | 20000 | ENGLAND |
5 | XYZ4 | 20000 | RUSSIA |
6 | XYZ5 | 20000 | SRI LANKA |
eid | ename | sal | ecountry |
---|---|---|---|
1 | XYZ | 20000 | INDIA |
eid | ename | sal | ecountry |
---|---|---|---|
6 | XYZ5 | 20000 | SRI LANKA |
eid | ename |
---|---|
1 | XYZ |
2 | XYZ1 |
3 | XYZ2 |
4 | XYZ3 |
5 | XYZ4 |
6 | XYZ5 |
eid | ename | sal | ecountry |
---|---|---|---|
2 | XYZ1 | 2000 | ENGLAND |
3 | XYZ2 | 2000 | INDIA |
ecountry |
---|
INDIA |
ENGLAND |
RUSSIA |
SRI LANKA |
ename |
---|
XYZ |
XYZ1 |
XYZ2 |
XYZ3 |
XYZ4 |
XYZ5 |
COUNT(DISTINCT ecountry) |
---|
4 |
COUNT(DISTINCT ename) |
---|
6 |
eid | ename | sal | ecountry |
---|---|---|---|
1 | XYZ | 20000 | INDIA |
3 | XYZ2 | 2000 | INDIA |
Subscribe to:
Posts (Atom)