0% found this document useful (0 votes)
37 views7 pages

Name - Soudagar Owais Javed ROLL NO - 24CO121 Batch - 03 DML Commands 1 - Query - (Department Table)

The document contains SQL commands for managing a database with tables for departments, students, instructors, courses, and enrollments. It includes commands for inserting, selecting, updating, and deleting records in these tables. The document provides examples of each operation along with their outputs.

Uploaded by

rehaan986750
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views7 pages

Name - Soudagar Owais Javed ROLL NO - 24CO121 Batch - 03 DML Commands 1 - Query - (Department Table)

The document contains SQL commands for managing a database with tables for departments, students, instructors, courses, and enrollments. It includes commands for inserting, selecting, updating, and deleting records in these tables. The document provides examples of each operation along with their outputs.

Uploaded by

rehaan986750
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

NAME – SOUDAGAR OWAIS JAVED

ROLL NO – 24CO121
BATCH – 03

DML COMMANDS

1 . QUERY – ( DEPARTMENT TABLE )


mysql> INSERT INTO department (dept_id, dept_name, office_phone, head_of_department)
VALUES
-> (1, 'Computer Science', '022-12345678', 'Dr. Nandini Rao'),
-> (2, 'Mechanical Engineering', '022-23456789', 'Dr. Rakesh Patil'),
-> (3, 'Electrical Engineering', '022-34567890', 'Dr. Farzana Sheikh'),
-> (4, 'Civil Engineering', '022-45678901', 'Dr. Mahesh Naik'),
-> (5, 'Information Technology', '022-56789012', 'Dr. Priya Kulkarni');
Query OK, 5 rows affected (0.01 sec)
Records: 5 Duplicates: 0 Warnings: 0

OUTPUT -

mysql> select * from department;


+---------+------------------------+--------------+--------------------+
| dept_id | dept_name | office_phone | head_of_department |
+---------+------------------------+--------------+--------------------+
| 1 | Computer Science | 022-12345678 | Dr. Nandini Rao |
| 2 | Mechanical Engineering | 022-23456789 | Dr. Rakesh Patil |
| 3 | Electrical Engineering | 022-34567890 | Dr. Farzana Sheikh |
| 4 | Civil Engineering | 022-45678901 | Dr. Mahesh Naik |
| 5 | Information Technology | 022-56789012 | Dr. Priya Kulkarni |
+---------+------------------------+--------------+--------------------+

2 . QUERY – (STUDENT TABLE )


mysql> INSERT INTO student (student_id, name, email, enrollment_year, dept_id) VALUES
-> (1, 'Owais Soudagar', '[email protected]', 2023, 1),
-> (2, 'Arun Bala', '[email protected]', 2022, 2),
-> (3, 'Sushant Garade', '[email protected]', 2024, 3),
-> (4, 'Vibhas Waghmare', '[email protected]', 2021, 1),
-> (5, 'Aryan Khillare', '[email protected]', 2022, 2),
-> (6, 'Haider Reza', '[email protected]', 2023, 3),
-> (7, 'Yash Dalvi', '[email protected]', 2024, 1),
-> (8, 'Pranit Araj', '[email protected]', 2021, 2),
-> (9, 'Omkar Ingavale', '[email protected]', 2022, 3),
-> (10, 'Ashish Singh', '[email protected]', 2023, 1);
Query OK, 10 rows affected (0.00 sec)
Records: 10 Duplicates: 0 Warnings: 0

OUPUT -

mysql> select * from student;


+------------+-----------------+---------------------------+-----------------+---------+
| student_id | name | email | enrollment_year | dept_id |
+------------+-----------------+---------------------------+-----------------+---------+
| 1 | Owais Soudagar | [email protected] | 2023 | 1|
| 2 | Arun Bala | [email protected] | 2022 | 2|
| 3 | Sushant Garade | [email protected] | 2024 | 3|
| 4 | Vibhas Waghmare | [email protected] | 2021 | 1|
| 5 | Aryan Khillare | [email protected] | 2022 | 2|
| 6 | Haider Reza | [email protected] | 2023 | 3|
| 7 | Yash Dalvi | [email protected] | 2024 | 1|
| 8 | Pranit Araj | [email protected] | 2021 | 2|
| 9 | Omkar Ingavale | [email protected] | 2022 | 3|
| 10 | Ashish Singh | [email protected] | 2023 | 1|
+------------+-----------------+---------------------------+-----------------+---------+

3 . QUERY – ( INSTRUCTOR TABLE )


mysql> INSERT INTO instructor (instructor_id, name, email, hire_date, dept_id) VALUES
-> (1, 'Dr. Ravi Kumar', '[email protected]', '2015-07-10', 1),
-> (2, 'Dr. Anjali Deshpande', '[email protected]', '2012-03-18', 2),
-> (3, 'Dr. Mohammed Imran', '[email protected]', '2018-11-25', 3),
-> (4, 'Dr. Pooja Sharma', '[email protected]', '2010-01-15', 4),
-> (5, 'Dr. Satish Rao', '[email protected]', '2016-06-30', 5),
-> (6, 'Dr. Kavita Nair', '[email protected]', '2014-09-20', 1),
-> (7, 'Dr. Ashok Singh', '[email protected]', '2013-05-05', 2),
-> (8, 'Dr. Farah Siddiqui', '[email protected]', '2017-08-14', 3),
-> (9, 'Dr. Manish Patel', '[email protected]', '2011-12-01', 4),
-> (10, 'Dr. Rekha Menon', '[email protected]', '2019-04-22', 5);
Query OK, 10 rows affected (0.01 sec)

OUTPUT -

mysql> select * from instructor;


+---------------+----------------------+----------------------------+------------+---------+
| instructor_id | name | email | hire_date | dept_id |
+---------------+----------------------+----------------------------+------------+---------+
| 1 | Dr. Ravi Kumar | [email protected] | 2015-07-10 | 1|
| 2 | Dr. Anjali Deshpande | [email protected] | 2012-03-18 | 2|
| 3 | Dr. Mohammed Imran | [email protected] | 2018-11-25 | 3|
| 4 | Dr. Pooja Sharma | [email protected] | 2010-01-15 | 4|
| 5 | Dr. Satish Rao | [email protected] | 2016-06-30 | 5|
| 6 | Dr. Kavita Nair | [email protected] | 2014-09-20 | 1|
| 7 | Dr. Ashok Singh | [email protected] | 2013-05-05 | 2|
| 8 | Dr. Farah Siddiqui | [email protected] | 2017-08-14 | 3|
| 9 | Dr. Manish Patel | [email protected] | 2011-12-01 | 4|
| 10 | Dr. Rekha Menon | [email protected] | 2019-04-22 | 5|
+---------------+----------------------+----------------------------+------------+---------+

4 . QUERY – ( COURSE TABLE )


mysql> INSERT INTO course (course_id, course_name, credits, semester_offered, dept_id,
instructor_id) VALUES
-> (1, 'Data Structures and Algorithms', 4, 1, 1, 1),
-> (2, 'Thermodynamics', 3, 2, 2, 2),
-> (3, 'Electrical Circuits', 4, 1, 3, 3),
-> (4, 'Structural Analysis', 3, 2, 4, 4),
-> (5, 'Database Management Systems', 4, 3, 5, 5);
Query OK, 5 rows affected (0.00 sec)
Records: 5 Duplicates: 0 Warnings: 0

OUTPUT -

mysql> select * from course;


+-----------+--------------------------------+---------+------------------+---------+---------------+
| course_id | course_name | credits | semester_offered | dept_id | instructor_id
|
+-----------+--------------------------------+---------+------------------+---------+---------------+
| 1 | Data Structures and Algorithms | 4|1 | 1| 1|
| 2 | Thermodynamics | 3|2 | 2| 2|
| 3 | Electrical Circuits | 4|1 | 3| 3|
| 4 | Structural Analysis | 3|2 | 4| 4|
| 5 | Database Management Systems | 4|3 | 5| 5|
+-----------+--------------------------------+---------+------------------+---------+---------------+

5 . QUERY – ( ENROLLMENT TABLE )


mysql> INSERT INTO enrollment (enrollment_id, student_id, course_id, semester, grade)
VALUES
-> (1, 1, 1, 1, 'A'),
-> (2, 2, 2, 2, 'B+'),
-> (3, 3, 3, 1, 'A-'),
-> (4, 4, 4, 2, 'B'),
-> (5, 5, 5, 3, 'A');
Query OK, 5 rows affected (0.00 sec)
Records: 5 Duplicates: 0 Warnings: 0

OUTPUT -

mysql> select * from enrollment;


+---------------+------------+-----------+----------+-------+
| enrollment_id | student_id | course_id | semester | grade |
+---------------+------------+-----------+----------+-------+
| 1| 1| 1|1 |A |
| 2| 2| 2|2 | B+ |
| 3| 3| 3|1 | A- |
| 4| 4| 4|2 |B |
| 5| 5| 5|3 |A |
+---------------+------------+-----------+----------+-------+
6 . QUERY – (UPDATE)
UPDATE student
SET
name = 'Sushant G. Garade',
email = '[email protected]',
dept_id = 2
WHERE
student_id = 3;

OUTPUT –
+------------+--------------------+-------------------------------+------------------+---------+
| student_id | name | email | enrollment_year | dept_id |
+------------+--------------------+-------------------------------+------------------+---------+
| 1 | Owais Soudagar | [email protected] | 2023 | 1|
| 2 | Arun Bala | [email protected] | 2022 | 2|
| 3 | Sushant G. Garade | [email protected] | 2024 | 2|
| 4 | Vibhas Waghmare | [email protected] | 2021 | 1|
| 5 | Aryan Khillare | [email protected] | 2022 | 2|
| 6 | Haider Reza | [email protected] | 2023 | 3|
| 7 | Yash Dalvi | [email protected] | 2024 | 1|
| 8 | Pranit Araj | [email protected] | 2021 | 2|
| 9 | Omkar Ingavale | [email protected] | 2022 | 3|
| 10 | Ashish Singh | [email protected] | 2023 | 1|
+------------+--------------------+-------------------------------+------------------+---------+
10 rows in set (0.00 sec)

7 . QUERY – ( DELETE )
DELETE FROM student
WHERE student_id = 5;

OUTPUT –
+------------+--------------------+-------------------------------+------------------+---------+
| student_id | name | email | enrollment_year | dept_id |
+------------+--------------------+-------------------------------+------------------+---------+
| 1 | Owais Soudagar | [email protected] | 2023 | 1|
| 2 | Arun Bala | [email protected] | 2022 | 2|
| 3 | Sushant G. Garade | [email protected] | 2024 | 2|
| 4 | Vibhas Waghmare | [email protected] | 2021 | 1|
| 6 | Haider Reza | [email protected] | 2023 | 3|
| 7 | Yash Dalvi | [email protected] | 2024 | 1|
| 8 | Pranit Araj | [email protected] | 2021 | 2|
| 9 | Omkar Ingavale | [email protected] | 2022 | 3|
| 10 | Ashish Singh | [email protected] | 2023 | 1|
+------------+--------------------+-------------------------------+------------------+---------+
9 rows in set (0.00 sec)

You might also like