├── A-01 Study of RDBMS_ MySQL
├── readme.md
└── start.png
├── A-02 SQL-DDL Commands
├── QUERIES.SQL
├── index.png
├── readme.md
├── seq.png
├── table.png
└── view.png
├── A-03 SQL-DML Commands
├── QUERIES.SQL
└── readme.md
├── A-04 SQL-DML Commands
├── QUERIES.SQL
└── readme.md
├── A-05 PLSQL Control Structures & Exception Handling
├── QUERIES.SQL
└── readme.md
├── A-07 PLSQL Stored Procedures
├── QUERIES.SQL
└── readme.md
├── A-08 Database Triggers
├── QUERIES.SQL
└── readme.md
└── readme.md
/A-01 Study of RDBMS_ MySQL/readme.md:
--------------------------------------------------------------------------------
1 | | Assignment 1: | Study of Open Source Relational Database : MySQL|
2 | |--|--|
3 |
4 | For more info : Refer [MySQL Documentation](https://dev.mysql.com/doc/)
5 | 
6 |
--------------------------------------------------------------------------------
/A-01 Study of RDBMS_ MySQL/start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WaderManasi/TE-DBMSLab-Assignments/4f142057e95035580f3d7fc73bfa13d9ae8c3ce5/A-01 Study of RDBMS_ MySQL/start.png
--------------------------------------------------------------------------------
/A-02 SQL-DDL Commands/QUERIES.SQL:
--------------------------------------------------------------------------------
1 | -- Name: Manasi Wader
2 | -- Topic: Demonstrating use of SQL Objects using DDL commands
3 |
4 | --Creating Table
5 | --In MySQL
6 | create TABLE tbl_student_details(
7 | stud_prn integer(10) primary key,
8 | stud_name varchar(20) not null,
9 | stud_class varchar(20) not null,
10 | stud_stream varchar(20) not null
11 | );
12 | --Oracle
13 | create TABLE tbl_student_details(
14 | stud_prn number(10) primary key,
15 | stud_name number(20) not null,
16 | stud_class number(20) not null,
17 | stud_stream number(20) not null
18 | );
19 |
20 | --Creating View
21 | -- MySQL and Oracle
22 | create VIEW vw_student_details as (
23 | select stud_name,
24 | stud_class
25 | from tbl_student_details
26 | );
27 |
28 | --Creating Index
29 | create INDEX indx_student_details ON tbl_student_details (stud_prn);
30 |
31 | --Creating index while table creation
32 | create TABLE dummy_table (
33 | col1 int(1),
34 | col2 int(5),
35 | col3 varchar(5),
36 | INDEX (col2,col3)
37 | );
38 |
39 | --Creating Sequence
40 | -- In MYSQL
41 | create table tbl_info(
42 | sr_no integer(2) AUTO_INCREMENT PRIMARY KEY,
43 | first_name varchar(10),
44 | last_name varchar(10)
45 | );
46 | --In Oracle
47 | SQL>create SEQUENCE customers_seq
48 | start with 1
49 | increment by 1
50 | nocycle
51 | nocache
52 | ;
53 | --customers_seq.nextval returns 2
54 |
55 | --Creating Synonym
56 |
57 | -- We cannnot create synonym in MySQL
58 |
59 | -- Below query can be excuted in Oracle
60 | SQL>create synonym StudentInfo for student;
--------------------------------------------------------------------------------
/A-02 SQL-DDL Commands/index.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WaderManasi/TE-DBMSLab-Assignments/4f142057e95035580f3d7fc73bfa13d9ae8c3ce5/A-02 SQL-DDL Commands/index.png
--------------------------------------------------------------------------------
/A-02 SQL-DDL Commands/readme.md:
--------------------------------------------------------------------------------
1 | | Assignment 2: | Design and Develop SQL DDL statements which demonstrate the use of SQL objects such as Table, View, Index, Sequence, Synonym|
2 | |--|--|
3 |
4 | |Command |Use |
5 | |--|--|
6 | |**CREATE**|To CREATE an object. Eg: Creating database, tables, triggers, index, functions, stored procedures, etc..|
7 | |**ALTER**|To ALTER the existing database or table or its object structures.|
8 | |**DROP**|To DROP the table by removing all its data and table structure.|
9 | |**TRUNCATE**|Used to remove entire data from table, but the table structure remains as it is! There is still existence of table structure.|
10 |
11 | #### [View Queries](https://github.com/WaderManasi/TE-DBMSLab-Assignments/blob/master/A-02%20SQL-DDL%20Commands/QUERIES.SQL)
12 |
13 | | | |
14 | |--|--|
15 | |[Table](https://github.com/WaderManasi/DBMS_Lab_Assignments/blob/master/A-02%20SQL:%20DDL%20Commands/queries.sql)|
|
16 | |[View](https://github.com/WaderManasi/DBMS_Lab_Assignments/blob/master/A-02%20SQL:%20DDL%20Commands/queries.sql)|
|
17 | |[Index](https://github.com/WaderManasi/DBMS_Lab_Assignments/blob/master/A-02%20SQL:%20DDL%20Commands/queries.sql)|
|
18 | |[Sequence](https://github.com/WaderManasi/DBMS_Lab_Assignments/blob/master/A-02%20SQL:%20DDL%20Commands/queries.sql)|
|
19 | |[Synonym](https://github.com/WaderManasi/DBMS_Lab_Assignments/blob/master/A-02%20SQL:%20DDL%20Commands/queries.sql)|
|
20 |
21 |
22 | #### SQL DDL Commands:
23 | - SQL Data Definition Language (DDL) commands are used for structuring of the data/table.
24 | - DDL commands are used to CREATE and MODIFY the structure of a Database and Database Objects.
25 | - DDL commands implicitly perform COMMIT operations.
26 | - Hence, these commands once fired cannot be ROLLBACKED!
27 |
28 | For more info : Refer [MySQL Documentation](https://dev.mysql.com/doc/)
--------------------------------------------------------------------------------
/A-02 SQL-DDL Commands/seq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WaderManasi/TE-DBMSLab-Assignments/4f142057e95035580f3d7fc73bfa13d9ae8c3ce5/A-02 SQL-DDL Commands/seq.png
--------------------------------------------------------------------------------
/A-02 SQL-DDL Commands/table.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WaderManasi/TE-DBMSLab-Assignments/4f142057e95035580f3d7fc73bfa13d9ae8c3ce5/A-02 SQL-DDL Commands/table.png
--------------------------------------------------------------------------------
/A-02 SQL-DDL Commands/view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WaderManasi/TE-DBMSLab-Assignments/4f142057e95035580f3d7fc73bfa13d9ae8c3ce5/A-02 SQL-DDL Commands/view.png
--------------------------------------------------------------------------------
/A-03 SQL-DML Commands/QUERIES.SQL:
--------------------------------------------------------------------------------
1 | -- Name: Manasi Wader
2 | -- Topic: Using SQL DML commands with operators,functions and set operator
3 |
4 | -- Inserting data into employee table
5 | insert into tbl_employee values (101,'Manasi',90000,'03-jun-2022');
6 | insert into tbl_employee values (102,'Manvika',75000,'08-jun-2022');
7 | insert into tbl_employee values (103,'Mayuri',95000,'08-july-2022');
8 | insert into tbl_employee values (104,'Sakshee',70000,'08-aug-2022');
9 | insert into tbl_employee values (105,'Lavanya',62000,'08-aug-2022');
10 | insert into tbl_employee values (106,'Kriti',50000,'08-sep-2022');
11 |
12 | -- Fetch all the inserted data
13 | select * from tbl_employee;
14 | select emp_name,emp_salary from tbl_employee;
15 | select emp_name,emp_salary from tbl_employee where emp_salary>80000;
16 |
17 | -- Update the values from existing columnof table
18 | update tbl_employee set emp_salary=75000 where lower(emp_name)='sakshee';
19 | update tbl_employee set emp_name='Manasi W' where emp_id=101;
20 | update tbl_employee set emp_name='Sakshee P' where emp_id=104;
21 |
22 | --delete certain records from employee table
23 | delete from tbl_employee where emp_salary<65000;
24 | --delete all rows
25 | delete from tbl_employee;
--------------------------------------------------------------------------------
/A-03 SQL-DML Commands/readme.md:
--------------------------------------------------------------------------------
1 | |Assignment 3:|Design at least 10 SQL queries for suitable database application using SQL DML statements: Insert, Select, Update, Delete with operators, functions, and set operator.|
2 | |--|--|
3 |
4 | |Command |Use |
5 | |--|--|
6 | |[**SELECT**](https://github.com/WaderManasi/DBMS_Lab_Assignments/blob/master/A-03%20SQL-DML%20Commands/QUERIES.SQL)|To SELECT ,retrieve or fetch data from database.|
7 | |[**INSERT**](https://github.com/WaderManasi/DBMS_Lab_Assignments/blob/master/A-03%20SQL-DML%20Commands/QUERIES.SQL)|To INSERT data into table.|
8 | |[**UPDATE**](https://github.com/WaderManasi/DBMS_Lab_Assignments/blob/master/A-03%20SQL-DML%20Commands/QUERIES.SQL)|To UPDATE the column values of a table.|
9 | |[**DELETE**](https://github.com/WaderManasi/DBMS_Lab_Assignments/blob/master/A-03%20SQL-DML%20Commands/QUERIES.SQL)|To DELETE the rows or remove entire data from tables.|
10 |
11 | #### [View Queries](https://github.com/WaderManasi/TE-DBMSLab-Assignments/blob/master/A-03%20SQL-DML%20Commands/QUERIES.SQL)
12 |
13 |
14 | For more info : Refer [MySQL Documentation](https://dev.mysql.com/doc/)
15 |
--------------------------------------------------------------------------------
/A-04 SQL-DML Commands/QUERIES.SQL:
--------------------------------------------------------------------------------
1 | -- Name: Manasi Wader
2 | -- Topic: Joins,Subquery,Views
3 |
4 | -- JOINS
5 |
6 | -- SUB-QUERY
7 | -- A subquery is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved.
8 | create table tbl_new as (select * from tbl_employee);
9 | select ProductName
10 | from Product
11 | where Id in (select ProductId
12 | from OrderItem
13 | where Quantity > 100
14 | )
15 | -- VIEW
16 |
17 | --Virtual view of table
18 | create view vw_employee as select emp_id,emp_name from tbl_employee;
19 |
20 | select * from vw_employee;
21 | insert into vw_employee values (107,'Aliya');
22 | insert into vw_employee values (108,'Gunjan');
23 |
24 | -- All changes made in view will be reflected in respective tables
25 | select * from tbl_employee;
26 |
27 | --permanently delete the data from view
28 | drop view vw_employee;
--------------------------------------------------------------------------------
/A-04 SQL-DML Commands/readme.md:
--------------------------------------------------------------------------------
1 | |Assignment 4:|Design at least 10 SQL queries for suitable database application using SQL DML statements: all types of Join, Sub-Query and View.|
2 | |--|--|
3 |
4 | #### [View Queries](https://github.com/WaderManasi/TE-DBMSLab-Assignments/blob/master/A-04%20SQL-DML%20Commands/QUERIES.SQL)
5 |
6 | For more info : Refer [MySQL Documentation](https://dev.mysql.com/doc/)
--------------------------------------------------------------------------------
/A-05 PLSQL Control Structures & Exception Handling/QUERIES.SQL:
--------------------------------------------------------------------------------
1 | -- Name: Manasi Wader
2 | -- Topic: Control Structures & Exceptions
3 |
4 | --Database:Oracle User: hr
5 | --IF in PLSQL
6 | declare
7 | marks number;
8 | namee varchar2(10);
9 | begin
10 | select sname into namee from acad_details where sno=101;
11 | select smarks into marks from acad_details where sno=101;
12 | dbms_output.put_line('Marks of '||namee||' is '||marks);
13 | if(marks>800)then
14 | dbms_output.put_line('Class: Distinction');
15 | elsif(marks>500) then
16 | dbms_output.put_line('Class: First Class');
17 | else
18 | dbms_output.put_line('Just Passed!');
19 | end if;
20 | end;
21 | /
22 | --
23 |
24 | create table acad_details(sname varchar(20),sno number(3),smarks number(5));
25 | select * from acad_details;
26 |
27 | --CASE in PLSQL
28 | declare
29 | grade char(1) := 'B';
30 | begin
31 | case grade
32 | when 'A' then dbms_output.put_line('A Grade: Excellent!');
33 | when 'B' then dbms_output.put_line('B Grade: Very Good');
34 | when 'C' then dbms_output.put_line('C Grade: Good');
35 | when 'D' then dbms_output.put_line('D Grade: Average');
36 | else dbms_output.put_line('Failed');
37 | end case;
38 | end;
39 | /
--------------------------------------------------------------------------------
/A-05 PLSQL Control Structures & Exception Handling/readme.md:
--------------------------------------------------------------------------------
1 | |Assignment 5:||
2 | |--|--|
3 |
4 |
5 | #### [View Queries](https://github.com/WaderManasi/TE-DBMSLab-Assignments/blob/master/A-05%20PLSQL%20Control%20Structures%20%26%20Exception%20Handling/QUERIES.SQL)
6 |
7 |
--------------------------------------------------------------------------------
/A-07 PLSQL Stored Procedures/QUERIES.SQL:
--------------------------------------------------------------------------------
1 | -- Name: Manasi Wader
2 | -- Topic: Stored Procedures
3 |
4 | -- Initially create table for student marks
5 | create table Stud_Marks(
6 | STUD_NAME varchar2(20),
7 | TOTAL_MARKS number(5)
8 | );
9 |
10 | -- Result table
11 | create table Result(
12 | STUD_NAME varchar2(20),
13 | ROLL_NO number(5),
14 | CLASS varchar2(20)
15 | );
16 |
17 | --Creating a stored procedure
18 | create or replace PROCEDURE PROC_GRADE1 AS
19 |
20 | BEGIN
21 | FOR i IN (SELECT * FROM Stud_Marks)
22 | LOOP
23 | DBMS_OUTPUT.PUT_LINE('Student Name: ' || i.Stud_Name || ' Student Marks: ' || i.Total_Marks);
24 | IF i.Total_Marks <=1500 AND i.Total_Marks >=990 THEN
25 | INSERT INTO Result (STUD_NAME,CLASS) VALUES (i.Stud_Name,'Distinction');
26 | ELSIF i.Total_Marks <=989 AND i.Total_Marks >=900 THEN
27 | INSERT INTO Result (STUD_NAME,CLASS) VALUES (i.Stud_Name,'First Class');
28 | ELSIF i.Total_Marks <=825 AND i.Total_Marks >=899 THEN
29 | INSERT INTO Result (STUD_NAME,CLASS) VALUES (i.Stud_Name,'Higher Second Class');
30 | END IF;
31 | END LOOP;
32 | COMMIT;
33 | END;
--------------------------------------------------------------------------------
/A-07 PLSQL Stored Procedures/readme.md:
--------------------------------------------------------------------------------
1 | |Assignment 7:|Write a Stored Procedure namely proc_Grade for the categorization of student. If marks scored by students in examination is <=1500 and marks>=990 then student will be placed in distinction category if marks scored are between 989 and900 category is first class, if marks 899 and 825 category is Higher Second Class Write a PL/SQL block for using procedure created with above requirement. Stud_Marks(name, total_marks) Result(Roll,Name, Class) Frame the separate problem statement for writing PL/SQL Stored Procedure and function, inline with above statement. The problem statement should clearly state the requirements.|
2 | |--|--|
3 |
4 |
5 | #### [View Queries](https://github.com/WaderManasi/TE-DBMSLab-Assignments/blob/master/A-07%20PLSQL%20Stored%20Procedures/QUERIES.SQL)
6 |
7 | For more info : Refer [MySQL Documentation](https://dev.mysql.com/doc/)
--------------------------------------------------------------------------------
/A-08 Database Triggers/QUERIES.SQL:
--------------------------------------------------------------------------------
1 | -- Name: Manasi Wader
2 | -- Topic: Statement Level Trigger
3 |
4 | /*
5 | First create tbl_library table and tbl_library_audit
6 | Insert data in tbl_library
7 | While updating or deleting data from tbl_library, old value and new value will be reflected in tbl_library_audit
8 | */
9 | create or replace trigger trg_library_af
10 | after update or delete on tbl_library for each row
11 | declare
12 | begin
13 | if updating then
14 | insert into tbl_library_audit values (:old.bk_no,:old.bk_name,:old.issue_date,:old.return_date);
15 | elsif deleting then
16 | insert into tbl_library_audit values (:old.bk_no,:old.bk_name,:old.issue_date,:old.return_date);
17 | end if;
18 | end
19 | ;
20 | /
--------------------------------------------------------------------------------
/A-08 Database Triggers/readme.md:
--------------------------------------------------------------------------------
1 | |Assignment 8:|Database Trigger (All Types: Row level and Statement level triggers, Before and After Triggers). Write a database trigger on Library table. The System should keep track of the records that are being updated or deleted. The old value of updated or deleted records should be added in Library_Audit table. Frame the problem statement for writing Database Triggers of all types, in-line with above statement. The problem statement should clearly state the requirements|
2 | |--|--|
3 |
4 | #### [View Queries](https://github.com/WaderManasi/TE-DBMSLab-Assignments/blob/master/A-08%20Database%20Triggers/QUERIES.SQL)
5 |
6 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | > ### :smile: :v: Just Practicing....
2 |
3 |
4 | |Assignment|Topic|
5 | |--|--|
6 | |[Assignment 1:](https://github.com/WaderManasi/TE-DBMSLab-Assignments/tree/master/A-01%20Study%20of%20RDBMS_%20MySQL) |Study of Open Source Relational Databases : MySQL|
7 | |[Assignment 2:](https://github.com/WaderManasi/TE-DBMSLab-Assignments/tree/master/A-02%20SQL-DDL%20Commands)|Design and Develop SQL DDL statements which demonstrate the use of SQL objects such as Table, View, Index, Sequence, Synonym|
8 | |[Assignment 3:](https://github.com/WaderManasi/TE-DBMSLab-Assignments/tree/master/A-03%20SQL-DML%20Commands)|Design at least 10 SQL queries for suitable database application using SQL DML statements: Insert, Select, Update, Delete with operators, functions, and set operator.|
9 | |[Assignment 4:](https://github.com/WaderManasi/TE-DBMSLab-Assignments/tree/master/A-04%20SQL-DML%20Commands)|Design at least 10 SQL queries for suitable database application using SQL DML statements: all types of Join, Sub-Query and View.|
10 | |[Assignment 7:](https://github.com/WaderManasi/TE-DBMSLab-Assignments/tree/master/A-07%20PLSQL%20Stored%20Procedures)|Write a Stored Procedure namely proc_Grade for the categorization of student. If marks scored by students in examination is <=1500 and marks>=990 then student will be placed in distinction category if marks scored are between 989 and900 category is first class, if marks 899 and 825 category is Higher Second Class Write a PL/SQL block for using procedure created with above requirement. Stud_Marks(name, total_marks) Result(Roll,Name, Class) Frame the separate problem statement for writing PL/SQL Stored Procedure and function, inline with above statement. The problem statement should clearly state the requirements.|
11 | |[Assignment 8:](https://github.com/WaderManasi/TE-DBMSLab-Assignments/tree/master/A-08%20Database%20Triggers)|Database Trigger (All Types: Row level and Statement level triggers, Before and After Triggers). Write a database trigger on Library table. The System should keep track of the records that are being updated or deleted. The old value of updated or deleted records should be added in Library_Audit table. Frame the problem statement for writing Database Triggers of all types, in-line with above statement. The problem statement should clearly state the requirements|
12 |
13 |
--------------------------------------------------------------------------------