Irfanali Dbs Test 02
Irfanali Dbs Test 02
Subject:
Database Systems lab
Name:
Irfan Ali
Sap id:
2392
Question.No1
Develop database of university portal create the following tables.
Teacher (techear_id (primary key), teacher name (unique and not null),
designation, Salary)
Student (Cms (primary_key), Student name, age , semester (not null))
Course (course_id (primarykey), course-name(not null and unique) ,
cms(forignkey)
,credit hour)
Ans:
Create user unversity_portal
Identified by abc;
GRANT CREATE SESSION TO unversity_portal;
GRANT CREATE TABLE TO unversity_portal;
GRANT CREATE VIEW TO unversity_portal;
GRANT CREATE SEQUENCE TO unversity_portal;
Question.no 2
Develop a system hotel management system create the following tables
Hotel (hotel-id(Primary key), Hotel-name ,room-id (foreign-key))
Room (Room_id(Primary key), Room-rent, check in(date) , check out (date) )
Employees (Employee_id(primary key), employee_name (unique), Salary )
Apply the following operations
Create the hotel table use default value of hotel-name which is (Usamania,
Tabaq, Envy continental and etc.)
Apply table level constraint in each table.
Insert at least 10 records in each table.
Remove all records in hotel table also hotel entity itself
Ans)
Create user hotel_manage_system
Identified by 440;
GRANT CREATE SESSION TO hotel_manage_system ;
GRANT CREATE TABLE TO hotel_manage_system ;
GRANT CREATE VIEW TO hotel_manage_system ;
GRANT CREATE SEQUENCE TO hotel_manage_system ;
Ans)
CREATE TABLE NEW_EMPLOYEES(EMPLOYEE_ID NUMBER(4),FIRST_NAME
VARCHAR2(20),LAST_NAME VARCHAR2(20),JOB_ID VARCHAR(10),SALARY NUMBER 10,
CONSTRAINT EMP_PK PRIMARY KEY(EMPLOYEE_ID));
========================THE END========================