0% found this document useful (0 votes)
5 views

Ass 05 DBMS Omkar

Uploaded by

Sahil Zaware
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)
5 views

Ass 05 DBMS Omkar

Uploaded by

Sahil Zaware
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/ 3

Subject: DBMS LAB

Name of Student : Sahil Zaware

Roll No: 13

Date of Performance:

Assignment No : 05

Aim: Execute DDL/DML statements which demonstrate the use of views. Update the

base table using its corresponding view. Also consider restrictions on updatable views

and perform view creation from multiple tables.

**********************************************************************************

mysql> create view stud_view as select rollno,stud_name,city from student; Query OK, 0 rows

affected (0.02 sec)

mysql> desc stud_view;

+-----------+-------------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+-----------+-------------+------+-----+---------+-------+

| rollno | int | NO | | NULL | |

| stud_name | varchar(30) | YES | | NULL | |

| city | varchar(30) | YES | | NULL | |

+-----------+-------------+------+-----+---------+-------+

3 rows in set (0.00 sec)

mysql> select * from stud_view;

+--------+-----------+----------+

| rollno | stud_name | city |

+--------+-----------+----------+

| 1 | Sahil | Parner |

| 3 | Suraj | Lonavala |

+--------+-----------+----------+

2 rows in set (0.01 sec)


mysql> create view student_view as select s.rollno,stud_name,submarks from student s,marks m
where s.rollno=m.rollno;

Query OK, 0 rows affected (0.01 sec) mysql>

select * from student_view;

+--------+-----------+----------+

| rollno | stud_name | submarks |

+--------+-----------+----------+

| 1 | Sahil | 13 |

| 3 | Suraj | 14 |

+--------+-----------+----------+ 2 rows in set (0.00 sec) mysql> create

or replace view stud_view as select * from student; Query OK, 0

rows affected (0.01 sec) mysql> update stud_view set

stud_name="Kiran" where rollno=3;

Query OK, 1 row affected (0.01 sec)

Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from stud_view;

+--------+-----------+----------+

| rollno | stud_name | city |

+--------+-----------+----------+

| 1 | Sahil |Parner |

| 3 | Kiran | Lonavala|

| 4 | Devendra | Ahmednagar |

+--------+-----------+----------+

3 rows in set (0.00 sec)

mysql> select * from student;

+--------+-----------+----------+----------+------+

| rollno | stud_name | city | mobno | Sid |

+--------+-----------+----------+----------+------+

| 1 |Sahil | Parner | 96374523 | NULL |


| 3 | Suraj | Lonavala | 35347876 | NULL |

| 4 | Devendra | Ahmednagar | 54637364 | 123 |

+--------+-----------+----------+----------+------+ 3

rows in set (0.00 sec) mysql> delete from

stud_view where rollno=3;

Query OK, 1 row affected (0.01 sec)

mysql> select * from stud_view;

+--------+-----------+-------+

| rollno | stud_name | city |

+--------+-----------+-------+

| 1 | Sahil | Parner |

| 4 | Devendra | Ahmednagar |

+--------+-----------+-------+

2 rows in set (0.00 sec)

You might also like