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)
18 views
5 pages
SQL Class 12 Cbse
Uploaded by
kaurashmeett
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 TXT, PDF, TXT or read online on Scribd
Download now
Download
Save SQL CLASS 12 CBSE For Later
Download
Save
Save SQL CLASS 12 CBSE For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
18 views
5 pages
SQL Class 12 Cbse
Uploaded by
kaurashmeett
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 TXT, PDF, TXT or read online on Scribd
Download now
Download
Save SQL CLASS 12 CBSE For Later
Carousel Previous
Carousel Next
Download
Save
Save SQL CLASS 12 CBSE For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 5
Search
Fullscreen
#WRITE A COMMAND TO CREATE A DATABASE
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ashmeet |
| butterfly |
| celeb |
| data |
| emp |
| employe |
| employees |
| empo |
| harman |
| la |
| management |
| mysql |
| records |
| seezal1 |
| tech |
| test |
| yo |
+--------------------+
18 rows in set (0.00 sec)
mysql> Create database ASHMEET;
Query OK, 1 row affected (0.00 sec)
#WRITE A COMMAND TO CREATE A TABLE
mysql> use ashmeet;
Database changed
mysql> create table student(
-> rollno integer(4),
-> name varchar(25),
-> marks decimal(5,2));
Query OK, 0 rows affected (0.03 sec)
mysql> desc student;
+--------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+-------+
| rollno | int(4) | YES | | NULL | |
| name | varchar(25) | YES | | NULL | |
| marks | decimal(5,2) | YES | | NULL | |
+--------+--------------+------+-----+---------+-------+
3 rows in set (0.03 sec)
mysql> use ashmeet;
Database changed
mysql> create table emp
-> (
-> emp_id char(4) primary key,
-> name varchar(10) not null,
-> desig varchar(10),
-> salary int,
-> gender char,
-> dept_no char(4)
-> );
Query OK, 0 rows affected (0.01 sec)
mysql> desc emp;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| emp_id | char(4) | NO | PRI | NULL | |
| name | varchar(10) | NO | | NULL | |
| desig | varchar(10) | YES | | NULL | |
| salary | int(11) | YES | | NULL | |
| gender | char(1) | YES | | NULL | |
| dept_no | char(4) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
6 rows in set (0.01 sec)
mysql> insert into emp
-> values("A001","Armaan","Programmer",60000,"M","200A");
Query OK, 1 row affected (0.00 sec)
mysql> select*from emp;
+--------+--------+------------+--------+--------+---------+
| emp_id | name | desig | salary | gender | dept_no |
+--------+--------+------------+--------+--------+---------+
| A001 | Armaan | Programmer | 60000 | M | 200A |
+--------+--------+------------+--------+--------+---------+
1 row in set (0.00 sec)
mysql> select*from emp;
+--------+----------+------------+--------+--------+---------+
| emp_id | name | desig | salary | gender | dept_no |
+--------+----------+------------+--------+--------+---------+
| A001 | Armaan | Programmer | 60000 | M | 200A |
| A002 | Ashish B | Manager | 70000 | M | Dep1 |
| A003 | Aanya | Programmer | 50000 | F | 200A |
| B001 | Brijesh | Sales MGR | 45000 | M | Dep2 |
| B002 | Baani | Clerk | 40000 | F | Dep3 |
+--------+----------+------------+--------+--------+---------+
5 rows in set (0.00 sec)
#WAC TO CREATE TABLE DEPARTMENT AND ADD RECORDS IN IT.
mysql> create table dept
-> (
-> emp_id char(4) primary key,
-> dept_no char(4) not null,
-> dept_head varchar(4),
-> dept_location varchar(20)
-> );
Query OK, 0 rows affected (0.02 sec)
mysql> alter table dept
-> modify dept_head varchar(20);
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> desc dept;
+---------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+-------+
| emp_id | char(4) | NO | PRI | NULL | |
| dept_no | char(4) | NO | | NULL | |
| dept_head | varchar(20) | YES | | NULL | |
| dept_location | varchar(20) | YES | | NULL | |
+---------------+-------------+------+-----+---------+-------+
4 rows in set (0.01 sec)
mysql> insert into dept
-> values("A001","200A","Durgesh Sharma","2nd floor Left wing");
Query OK, 1 row affected (0.00 sec)
mysql> insert into dept
-> values("B001","200A","Durgesh Sharma","2nd floor Left wing");
Query OK, 1 row affected (0.00 sec)
mysql> alter table dept
-> modify dept_location varchar(30);
Query OK, 2 rows affected (0.02 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql>mysql> insert into dept
-> values("C002","Dep6","Avinash Sharma","3rd floor Middle wing");
Query OK, 1 row affected (0.00 sec)
mysql> insert into dept
-> values("D003","Dep7","Harshit Chandhokh","1st floor Next to Cafeteria");
Query OK, 1 row affected (0.00 sec)
mysql> insert into dept
-> values("E004","Dep8","Divya Sehgal","4th floor");
Query OK, 1 row affected (0.01 sec)
mysql> insert into dept
-> values("C006","Dep9","Priya Singhania","3rd floor Right & Left Wing");
Query OK, 1 row affected (0.00 sec)
mysql> insert into dept
-> values("F001","DE10","Ayaan Mehrotra","2nd Floor Right Wing");
Query OK, 1 row affected (0.00 sec)
mysql> insert into dept
-> values("D002","Dep7","Harshit Chandhokh","1st floor Next to cafeteria");
Query OK, 1 row affected (0.00 sec)
mysql> select*from dept;
+--------+---------+-------------------+-----------------------------+
| emp_id | dept_no | dept_head | dept_location |
+--------+---------+-------------------+-----------------------------+
| A001 | 200A | Durgesh Sharma | 2nd floor Left wing |
| B001 | 200A | Durgesh Sharma | 2nd floor Left wing |
| C002 | Dep6 | Avinash Sharma | 3rd floor Middle wing |
| C006 | Dep9 | Priya Singhania | 3rd floor Right & Left Wing |
| D002 | Dep7 | Harshit Chandhokh | 1st floor Next to cafeteria |
| D003 | Dep7 | Harshit Chandhokh | 1st floor Next to Cafeteria |
| E004 | Dep8 | Divya Sehgal | 4th floor |
| F001 | DE10 | Ayaan Mehrotra | 2nd Floor Right Wing |
+--------+---------+-------------------+-----------------------------+
8 rows in set (0.02 sec)
mysql> select name,desig,salary*12 as 'Annual Salary' from emp;
+----------+------------+---------------+
| name | desig | Annual Salary |
+----------+------------+---------------+
| Armaan | Programmer | 720000 |
| Ashish B | Manager | 840000 |
| Aanya | Programmer | 600000 |
| Brijesh | Sales MGR | 540000 |
| Baani | Clerk | 480000 |
| Shareen | Programmer | 1056000 |
| Cherry | Designer | 840000 |
| Drishti | Head Clerk | 660000 |
+----------+------------+---------------+
8 rows in set (0.00 sec)
#FUNCTIONS
mysql> use ashmeet;
Database changed
mysql> select*from emp;
+--------+----------+------------+--------+--------+---------+
| emp_id | name | desig | salary | gender | dept_no |
+--------+----------+------------+--------+--------+---------+
| A001 | Armaan | Programmer | 60000 | M | 200A |
| A002 | Ashish B | Manager | 70000 | M | Dep1 |
| A003 | Aanya | Programmer | 50000 | F | 200A |
| B001 | Brijesh | Sales MGR | 45000 | M | Dep2 |
| B002 | Baani | Clerk | 40000 | F | Dep3 |
| B003 | Shareen | Programmer | 88000 | M | 200A |
| C003 | Cherry | Designer | 70000 | F | Dep4 |
| D005 | Drishti | Head Clerk | 55000 | F | Dep5 |
+--------+----------+------------+--------+--------+---------+
8 rows in set (0.02 sec)
mysql> select*from dept;
+--------+---------+-------------------+-----------------------------+
| emp_id | dept_no | dept_head | dept_location |
+--------+---------+-------------------+-----------------------------+
| A001 | 200A | Durgesh Sharma | 2nd floor Left wing |
| B001 | 200A | Durgesh Sharma | 2nd floor Left wing |
| C002 | Dep6 | Avinash Sharma | 3rd floor Middle wing |
| C006 | Dep9 | Priya Singhania | 3rd floor Right & Left Wing |
| D002 | Dep7 | Harshit Chandhokh | 1st floor Next to cafeteria |
| D003 | Dep7 | Harshit Chandhokh | 1st floor Next to Cafeteria |
| E004 | Dep8 | Divya Sehgal | 4th floor |
| F001 | DE10 | Ayaan Mehrotra | 2nd Floor Right Wing |
+--------+---------+-------------------+-----------------------------+
8 rows in set (0.02 sec)
mysql> select sum(salary) from emp;
+-------------+
| sum(salary) |
+-------------+
| 478000 |
+-------------+
1 row in set (0.00 sec)
mysql> select count(salary) from emp;
+---------------+
| count(salary) |
+---------------+
| 8 |
+---------------+
1 row in set (0.00 sec)
mysql> select count(*) from emp;
+----------+
| count(*) |
+----------+
| 8 |
+----------+
1 row in set (0.00 sec)
mysql> select*from emp where desig="Programmer" and name like "a%";
+--------+--------+------------+--------+--------+---------+
| emp_id | name | desig | salary | gender | dept_no |
+--------+--------+------------+--------+--------+---------+
| A001 | Armaan | Programmer | 60000 | M | 200A |
| A003 | Aanya | Programmer | 50000 | F | 200A |
+--------+--------+------------+--------+--------+---------+
2 rows in set (0.00 sec)
mysql> select*from emp order by name;
+--------+----------+------------+--------+--------+---------+
| emp_id | name | desig | salary | gender | dept_no |
+--------+----------+------------+--------+--------+---------+
| A003 | Aanya | Programmer | 50000 | F | 200A |
| A001 | Armaan | Programmer | 60000 | M | 200A |
| A002 | Ashish B | Manager | 70000 | M | Dep1 |
| B002 | Baani | Clerk | 40000 | F | Dep3 |
| B001 | Brijesh | Sales MGR | 45000 | M | Dep2 |
| C003 | Cherry | Designer | 70000 | F | Dep4 |
| D005 | Drishti | Head Clerk | 55000 | F | Dep5 |
| B003 | Shareen | Programmer | 88000 | M | 200A |
+--------+----------+------------+--------+--------+---------+
8 rows in set (0.02 sec)
mysql>
You might also like
DBML 3
PDF
No ratings yet
DBML 3
6 pages
Apache Cassandra Administrator Associate - Exam Practice Tests
From Everand
Apache Cassandra Administrator Associate - Exam Practice Tests
Cristian Scutaru
No ratings yet
SQL Database
PDF
No ratings yet
SQL Database
18 pages
HP10E Operating Manual
PDF
No ratings yet
HP10E Operating Manual
189 pages
Simulations Imp Questions
PDF
No ratings yet
Simulations Imp Questions
1 page
CSCI250 Introduction To Programming - FinalExam-Sample2 - Solution
PDF
No ratings yet
CSCI250 Introduction To Programming - FinalExam-Sample2 - Solution
5 pages
Record Mysql Emp
PDF
No ratings yet
Record Mysql Emp
8 pages
Table creation (1)
PDF
No ratings yet
Table creation (1)
6 pages
DBMS Final Code
PDF
No ratings yet
DBMS Final Code
60 pages
Cse3a 80 Assgn02
PDF
No ratings yet
Cse3a 80 Assgn02
6 pages
SQL
PDF
No ratings yet
SQL
17 pages
Resturent Final
PDF
No ratings yet
Resturent Final
12 pages
Mysql by Ajay Tiwari
PDF
No ratings yet
Mysql by Ajay Tiwari
8 pages
DBMS Practical
PDF
No ratings yet
DBMS Practical
39 pages
Dbms 3
PDF
No ratings yet
Dbms 3
9 pages
Da155 Mukesh Kanna
PDF
No ratings yet
Da155 Mukesh Kanna
17 pages
input and outputs of pl sql
PDF
No ratings yet
input and outputs of pl sql
8 pages
Assignment 5
PDF
No ratings yet
Assignment 5
2 pages
Dbms Sachin
PDF
No ratings yet
Dbms Sachin
19 pages
Assign 5 SQL
PDF
No ratings yet
Assign 5 SQL
9 pages
DBMS PRACTICAL 2
PDF
No ratings yet
DBMS PRACTICAL 2
6 pages
DBPR 3
PDF
No ratings yet
DBPR 3
4 pages
Document From Nishad
PDF
No ratings yet
Document From Nishad
46 pages
Sql Queries_Madhu
PDF
No ratings yet
Sql Queries_Madhu
25 pages
Adobe Scan 23 May 2023
PDF
No ratings yet
Adobe Scan 23 May 2023
5 pages
DMS Practical-8 Final
PDF
No ratings yet
DMS Practical-8 Final
2 pages
Practical 4
PDF
No ratings yet
Practical 4
11 pages
Built in Function Praticals
PDF
No ratings yet
Built in Function Praticals
11 pages
sql2
PDF
No ratings yet
sql2
5 pages
SQL Rev 2
PDF
No ratings yet
SQL Rev 2
21 pages
Practice Joins
PDF
No ratings yet
Practice Joins
14 pages
SQL Practicals (1)
PDF
No ratings yet
SQL Practicals (1)
7 pages
IT 802 Practical File 2025-26 Java + SQL-2
PDF
No ratings yet
IT 802 Practical File 2025-26 Java + SQL-2
39 pages
nj
PDF
No ratings yet
nj
4 pages
mysql (2)
PDF
No ratings yet
mysql (2)
12 pages
DBMS Recap
PDF
No ratings yet
DBMS Recap
10 pages
Dbms Lab7
PDF
No ratings yet
Dbms Lab7
2 pages
SEM-4 SQL Assignment - Copy
PDF
No ratings yet
SEM-4 SQL Assignment - Copy
9 pages
MySQL
PDF
No ratings yet
MySQL
16 pages
106121092 - Prajwal Sundar
PDF
No ratings yet
106121092 - Prajwal Sundar
79 pages
Day 14 mysql commands by Swati Chawla
PDF
No ratings yet
Day 14 mysql commands by Swati Chawla
59 pages
Class 12
PDF
No ratings yet
Class 12
5 pages
Program 2 and 3
PDF
No ratings yet
Program 2 and 3
16 pages
My SQL
PDF
No ratings yet
My SQL
7 pages
SQL1
PDF
No ratings yet
SQL1
2 pages
Office
PDF
No ratings yet
Office
6 pages
Rahul SQL File 18.04.2024
PDF
No ratings yet
Rahul SQL File 18.04.2024
10 pages
Database (Mysql)
PDF
No ratings yet
Database (Mysql)
22 pages
My Dreams Ql Queries
PDF
No ratings yet
My Dreams Ql Queries
36 pages
EXP 2
PDF
No ratings yet
EXP 2
3 pages
Exp1 DWM
PDF
No ratings yet
Exp1 DWM
10 pages
Practical No 02 (B)
PDF
No ratings yet
Practical No 02 (B)
6 pages
91 Club
PDF
No ratings yet
91 Club
16 pages
Program-9: To Create View and Use of Insert, Delete, Select and Update Commands in View Viewing Contents of Employee Table
PDF
No ratings yet
Program-9: To Create View and Use of Insert, Delete, Select and Update Commands in View Viewing Contents of Employee Table
6 pages
Create View in Mysql
PDF
No ratings yet
Create View in Mysql
10 pages
Mysql programs (2)
PDF
No ratings yet
Mysql programs (2)
23 pages
II Bsc Cs-A-database System-lab Record-April-2025 (76 Copies)
PDF
No ratings yet
II Bsc Cs-A-database System-lab Record-April-2025 (76 Copies)
34 pages
Kakde, Om
PDF
No ratings yet
Kakde, Om
5 pages
Xii CS Slow Leaners - SQL
PDF
No ratings yet
Xii CS Slow Leaners - SQL
4 pages
Mysql
PDF
No ratings yet
Mysql
12 pages
cs
PDF
No ratings yet
cs
12 pages
sql
PDF
No ratings yet
sql
14 pages
Assignment 7
PDF
No ratings yet
Assignment 7
6 pages
Secant Method
PDF
No ratings yet
Secant Method
4 pages
Mcom2
PDF
No ratings yet
Mcom2
1 page
Smartforms For Beginners
PDF
No ratings yet
Smartforms For Beginners
27 pages
Chapter 1 Quiz - CET501f13 Applied Networking I
PDF
100% (1)
Chapter 1 Quiz - CET501f13 Applied Networking I
7 pages
31-60 PS
PDF
No ratings yet
31-60 PS
36 pages
Autoplus MPC
PDF
No ratings yet
Autoplus MPC
64 pages
Lenovo X1 Corbon 12298-2
PDF
No ratings yet
Lenovo X1 Corbon 12298-2
80 pages
GAWARAN, Cherry Rose Telmo-CaseStudy1
PDF
No ratings yet
GAWARAN, Cherry Rose Telmo-CaseStudy1
3 pages
RLC Series: Experiment No:-06 DATE: - 08/05/2020
PDF
No ratings yet
RLC Series: Experiment No:-06 DATE: - 08/05/2020
6 pages
00 Changes
PDF
No ratings yet
00 Changes
2 pages
BET Manual ENG (2020)
PDF
No ratings yet
BET Manual ENG (2020)
112 pages
7.Module Pool Prog
PDF
No ratings yet
7.Module Pool Prog
17 pages
New Software Version 3 45
PDF
No ratings yet
New Software Version 3 45
2 pages
UNESCOEmploymentHistoryForm Updated Template Final
PDF
100% (1)
UNESCOEmploymentHistoryForm Updated Template Final
4 pages
Robotics Notes
PDF
No ratings yet
Robotics Notes
15 pages
Aqthas Resume PDF
PDF
No ratings yet
Aqthas Resume PDF
3 pages
Java Interview Questions For 2 Years Experienced
PDF
No ratings yet
Java Interview Questions For 2 Years Experienced
8 pages
1012 Blasting Courses
PDF
No ratings yet
1012 Blasting Courses
8 pages
ARCHICAD Introduction Tutorial Starting A New Project
PDF
No ratings yet
ARCHICAD Introduction Tutorial Starting A New Project
26 pages
Design Thinking Research - Making Distinctions - Collaboration Versus Cooperation
PDF
100% (2)
Design Thinking Research - Making Distinctions - Collaboration Versus Cooperation
372 pages
Thesis
PDF
No ratings yet
Thesis
52 pages
Full Download Starting Out With Python 4th Edition Gaddis Test Bank PDF
PDF
100% (3)
Full Download Starting Out With Python 4th Edition Gaddis Test Bank PDF
28 pages
SQL MCQ
PDF
No ratings yet
SQL MCQ
6 pages
The Other Side of Paradise
PDF
No ratings yet
The Other Side of Paradise
3 pages
94 TS
PDF
No ratings yet
94 TS
28 pages
Power BI: Business Intelligence Concepts Refer To The Usage of Digital
PDF
No ratings yet
Power BI: Business Intelligence Concepts Refer To The Usage of Digital
4 pages
2499368_E_20250106 [Warning] Some of the data sources in the document cannot be transported
PDF
No ratings yet
2499368_E_20250106 [Warning] Some of the data sources in the document cannot be transported
2 pages