DBMS Programs
DBMS Programs
Find the names of students who’s name Update the data record in view table
ends with letter ‘A’ UPDATE Student_Marks_View SET sub1 =
SELECT sname FROM Student WHERE 95 WHERE Sid = 1;
sname LIKE '%A';
Drop all the views which you are created
Find the sid of the class toper DROP VIEW IF EXISTS AIML_Students;
SELECT Sid FROM Marks ORDER BY DROP VIEW IF EXISTS
total DESC LIMIT 1; Student_Marks_View;
Convert Attributes:
Simple attributes become columns in the
corresponding table.
ER model to a relational model: Composite attributes are broken down into
Convert Entities to Tables: simple attributes.
Create a table for each strong entity with its Multi-valued attributes are converted to a
attributes. separate table with a foreign key.
Create a table for each weak entity with a Set Primary Keys:
foreign key referencing the strong entity it Assign primary keys to each table based on
depends on. the entity’s unique identifier.
Convert Relationships to Tables: Set Foreign Keys:
One-to-One Relationships: Add a foreign Establish foreign keys to maintain
key to one of the tables involved in the referential integrity between related tables.
relationship. Handle Derived Attributes:
One-to-Many Relationships: Add a foreign Determine whether derived attributes
key to the table on the “many” side of the should be stored or calculated as needed.
relationship. Normalize the Tables:
Many-to-Many Relationships: Create a new Ensure tables are normalized to reduce
table to represent the relationship, including redundancy and improve data integrity.
foreign keys referencing the primary keys
of the related tables.