Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
13 views
6 pages
Dbms 3
this is a program sheet of creating a data base using mysql
Uploaded by
learn.shwetankpandey
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF, TXT or read online on Scribd
Download
Save
Save dbms 3 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
13 views
6 pages
Dbms 3
this is a program sheet of creating a data base using mysql
Uploaded by
learn.shwetankpandey
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF, TXT or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save dbms 3 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save dbms 3 For Later
You are on page 1
/ 6
Search
Fullscreen
Shwetank Pandey, 2301420042 ,b.
tech cse
create database sp;
use sp;
create table Departement( Deptno int primary key
,Dname varchar(15) not null);
insert into Departement values
(40,"OPERATION");
SELECT * FROM Departement;
create table employee( empno int (4)primary key,
ename varchar(20) not null, job varchar(20),mgr
int(4), herdate Date ,sal int(10) ,comm int(7),
Deptno varchar(2) );
ALTER TABLE Departement
MODIFY COLUMN Deptno VARCHAR(2);
ALTER TABLE employee
CHANGE COLUMN herdate hiredate DATE;
ALTER TABLE employee
ADD CONSTRAINT fk_Deptno
FOREIGN KEY (Deptno)
REFERENCES Departement(Deptno);
TRUNCATE TABLE employee;
INSERT INTO employee (empno, ename, job,
mgr, hiredate, sal, comm, deptno) VALUE
(7788, 'SCOTT', 'ANALYST', 7566, '1982-12-09',
3000, NULL, '40'),
(7369, 'SMITH', 'CLERK', 7902, '1980-12-17', 800,
NULL, 20),
(7499, 'ALLEN', 'SALESMAN', 7698, '1981-02-20',
1600, 300, 30),
(7521, 'WARD', 'SALESMAN', 7698, '1981-02-22',
1250, 300, 30),
(7566, 'JONES', 'MANAGER', 7839, '1981-04-02',
2975, NULL, 20),
(7654, 'MARTIN', 'SALESMAN', 7698, '1981-09-
28', 1250, 1400, 30),
(7698, 'BLAKE', 'MANAGER', 7839, '1981-05-01',
2850, NULL, 30),
(7782, 'CLARK', 'MANAGER', 7839, '1981-06-09',
2450, NULL, 20),
(7839, 'KING', 'PRESIDENT', NULL, '1981-11-17',
5000, NULL, 20),
(7844, 'TURNER', 'SALESMAN', 7698, '1981-09-
08', 1500, 0, 30),
(7876, 'ADAMS', 'CLERK', 7788, '1983-01-12',
1100, NULL, 20),
(7900, 'JAMES', 'CLERK', 7698, '1981-12-03', 950,
NULL, 30),
(7902, 'FORD', 'ANALYST', 7566, '1981-12-03',
3000, NULL, 20),
(7934, 'MILLER', 'CLERK', 7782, '1982-01-23',
1300, NULL, 10);
select * from Departement;
select * from employee;
--------------------
select * from employee
where job = 'salesman' or comm>300;
select deptno from employee;
select distinct deptno from employee;
select sum(sal) as sumsalary from employee
where job = 'manager';
select min(sal ) as minsalary , max(sal) as maxsalary;
select count(empno) as empnocount from employee
where job= 'manager';
select count(empno) as empnocount, sum(sal) as
sumsalary
from employee where job= 'manager';
select deptno , count(empno) as countemp ,sum(sal) as
sumsalary
from employee
group by deptno;
select deptno , count(empno) as countemp ,sum(sal) as
sumsalary
from employee
group by deptno having count(empno)>1 order by
deptno;
select job,count(*) from employee group by job order by
count(*) desc;
select job, sum(sal),max(sal),min(Sal),avg(sal)
from employee group by job
having avg(sal)>1000;
select job,sum(sal) from employee group by job;
select deptno,count(empno) from employee
group by deptno;
SELECT job, COUNT(*) AS empn
FROM employee
GROUP BY job;
SELECT job, SUM(sal) AS total_salary
FROM employee
GROUP BY job;
SELECT deptno, COUNT(*) AS total_employees
FROM employee
GROUP BY deptno
HAVING COUNT(*) > 3;
SELECT deptno, MAX(sal) AS max_salary
FROM employee
GROUP BY deptno;
SELECT job, SUM(sal) AS total_salary
FROM employee
GROUP BY job
HAVING SUM(sal) > 40000;
SELECT job, COUNT(*) AS total_employees
FROM employee
GROUP BY job
HAVING COUNT(*) > 3;
You might also like
20 SQL Exercises For Practice: Table Structure and Schema
PDF
100% (5)
20 SQL Exercises For Practice: Table Structure and Schema
12 pages
PL-SQL - Notes
PDF
100% (3)
PL-SQL - Notes
13 pages
Data Engineering Pre-Interview Quiz MCQ
PDF
100% (1)
Data Engineering Pre-Interview Quiz MCQ
8 pages
Udemy Premium
PDF
No ratings yet
Udemy Premium
15 pages
Oracle SQL PLSQL Questions
PDF
No ratings yet
Oracle SQL PLSQL Questions
12 pages
FYBBA CA PracticalSlips Sem2
PDF
100% (5)
FYBBA CA PracticalSlips Sem2
30 pages
Migrating SQL Server To Azure SQL Database Managed Instance: A Step-By-Step Guide
PDF
100% (1)
Migrating SQL Server To Azure SQL Database Managed Instance: A Step-By-Step Guide
21 pages
SQL Scripting & AMDP
PDF
100% (1)
SQL Scripting & AMDP
11 pages
Note 5-7
PDF
No ratings yet
Note 5-7
21 pages
Unit 4 Pig and Hive
PDF
No ratings yet
Unit 4 Pig and Hive
86 pages
Source Code Dbms
PDF
No ratings yet
Source Code Dbms
14 pages
DFC20123 Chap 2 Relational Data Model
PDF
No ratings yet
DFC20123 Chap 2 Relational Data Model
76 pages
Halimbawa NG Term Paper Filipino
PDF
100% (1)
Halimbawa NG Term Paper Filipino
6 pages
Dbms Question Bank Unit I
PDF
100% (1)
Dbms Question Bank Unit I
2 pages
Dbms Answers All - Haam's Community
PDF
No ratings yet
Dbms Answers All - Haam's Community
55 pages
SQL
PDF
No ratings yet
SQL
53 pages
Mysql
PDF
No ratings yet
Mysql
6 pages
Database
PDF
No ratings yet
Database
122 pages
BCA 2022-2023 Onwards
PDF
No ratings yet
BCA 2022-2023 Onwards
48 pages
SQL Empl Table
PDF
0% (1)
SQL Empl Table
2 pages
Simple and Complex Queries
PDF
No ratings yet
Simple and Complex Queries
31 pages
Emp Script Mysql
PDF
No ratings yet
Emp Script Mysql
1 page
Group by
PDF
No ratings yet
Group by
7 pages
Dbms Final
PDF
No ratings yet
Dbms Final
25 pages
CH05 CompSec4e
PDF
No ratings yet
CH05 CompSec4e
39 pages
Hostel Database Management System
PDF
No ratings yet
Hostel Database Management System
38 pages
SQL Queries
PDF
No ratings yet
SQL Queries
10 pages
ILS3A01 Week 1
PDF
No ratings yet
ILS3A01 Week 1
32 pages
DBMS Assignment
PDF
No ratings yet
DBMS Assignment
15 pages
Unit-3 SQL - Practical Demonstration
PDF
No ratings yet
Unit-3 SQL - Practical Demonstration
14 pages
SCHEMA1
PDF
No ratings yet
SCHEMA1
19 pages
All Labs
PDF
No ratings yet
All Labs
5 pages
Oracle Webdb: Release Notes
PDF
No ratings yet
Oracle Webdb: Release Notes
10 pages
SQL
PDF
No ratings yet
SQL
12 pages
Dbms
PDF
No ratings yet
Dbms
6 pages
Lab 4
PDF
No ratings yet
Lab 4
13 pages
Avocet2017.2.38Release Notes
PDF
No ratings yet
Avocet2017.2.38Release Notes
14 pages
MySQL5 With Answers
PDF
No ratings yet
MySQL5 With Answers
6 pages
Week 5
PDF
No ratings yet
Week 5
10 pages
Practise
PDF
No ratings yet
Practise
21 pages
Untitled
PDF
No ratings yet
Untitled
12 pages
RDBMS1
PDF
No ratings yet
RDBMS1
7 pages
IP - MySQL Practical File
PDF
No ratings yet
IP - MySQL Practical File
9 pages
Lab No. 1
PDF
No ratings yet
Lab No. 1
6 pages
Interview Questions With Answers
PDF
No ratings yet
Interview Questions With Answers
11 pages
Lab Assignment 3 DBMS
PDF
No ratings yet
Lab Assignment 3 DBMS
13 pages
Mysql Practice
PDF
No ratings yet
Mysql Practice
10 pages
IP - MySQL Practical File
PDF
No ratings yet
IP - MySQL Practical File
9 pages
Pragmatic Api Integration
PDF
No ratings yet
Pragmatic Api Integration
11 pages
W3Schools Quiz Results1
PDF
No ratings yet
W3Schools Quiz Results1
8 pages
Mysql Practical File Assignment
PDF
No ratings yet
Mysql Practical File Assignment
6 pages
Queries
PDF
No ratings yet
Queries
4 pages
SQL A
PDF
No ratings yet
SQL A
5 pages
4 IM Aggregation and Grouping
PDF
No ratings yet
4 IM Aggregation and Grouping
10 pages
SQL New Assignment 2
PDF
No ratings yet
SQL New Assignment 2
5 pages
SQL Commands Query
PDF
No ratings yet
SQL Commands Query
6 pages
Beulke How To Do A Performance Review WAIUG 2005
PDF
No ratings yet
Beulke How To Do A Performance Review WAIUG 2005
9 pages
Dbms
PDF
No ratings yet
Dbms
6 pages
Document
PDF
No ratings yet
Document
13 pages
SQL Practice
PDF
No ratings yet
SQL Practice
4 pages
DBMS Assesment
PDF
No ratings yet
DBMS Assesment
4 pages
Project Document Template
PDF
No ratings yet
Project Document Template
5 pages
VMD Interview Quetions
PDF
No ratings yet
VMD Interview Quetions
5 pages
Dbms 4
PDF
No ratings yet
Dbms 4
5 pages
Class XII - CS - Practical Programs 20 and 21
PDF
No ratings yet
Class XII - CS - Practical Programs 20 and 21
5 pages
Group by Having
PDF
No ratings yet
Group by Having
3 pages
SQL Mastery Set 1 (110 Questions)
PDF
No ratings yet
SQL Mastery Set 1 (110 Questions)
7 pages
Set-2 - Interviewquestionspdf
PDF
No ratings yet
Set-2 - Interviewquestionspdf
7 pages
Assignment-1 Dbms
PDF
No ratings yet
Assignment-1 Dbms
3 pages
Creating A DEPARTMENT Tables
PDF
No ratings yet
Creating A DEPARTMENT Tables
4 pages
Wa0014.
PDF
No ratings yet
Wa0014.
4 pages
SQL Subqueries
PDF
No ratings yet
SQL Subqueries
5 pages
SQL Excersise
PDF
No ratings yet
SQL Excersise
2 pages
SQL Learning Queries
PDF
No ratings yet
SQL Learning Queries
15 pages
3rd Company
PDF
No ratings yet
3rd Company
2 pages
Sql-Task
PDF
No ratings yet
Sql-Task
2 pages
9th Employee
PDF
No ratings yet
9th Employee
1 page
Assignment-2 DBMS
PDF
No ratings yet
Assignment-2 DBMS
3 pages
Practical 1 DBMS
PDF
No ratings yet
Practical 1 DBMS
3 pages
Create Database Test
PDF
No ratings yet
Create Database Test
5 pages
Create Table Employee
PDF
No ratings yet
Create Table Employee
2 pages
Sampledatabase (1) - 6290872 - 2024 - 10 - 01 - 19 - 31
PDF
No ratings yet
Sampledatabase (1) - 6290872 - 2024 - 10 - 01 - 19 - 31
2 pages
LiveSQL 1
PDF
No ratings yet
LiveSQL 1
2 pages
Key and Forigen Key: 1. Create A Table and Specific The Primary
PDF
No ratings yet
Key and Forigen Key: 1. Create A Table and Specific The Primary
5 pages
Test Answers SQL 18-02-2025
PDF
No ratings yet
Test Answers SQL 18-02-2025
2 pages
CrEmpDep New
PDF
No ratings yet
CrEmpDep New
1 page
SQL Queries: 200+ Queries to Challenge you.
From Everand
SQL Queries: 200+ Queries to Challenge you.
Swaroop Kallakuri
5/5 (2)
Sql Plsql Oracle
From Everand
Sql Plsql Oracle
Andrew Igla
No ratings yet
Profound Python Data Science
From Everand
Profound Python Data Science
Onder Teker
No ratings yet
Computer Engineering Laboratory Solution Primer
From Everand
Computer Engineering Laboratory Solution Primer
Karan Bhandari
No ratings yet