PDF Document
PDF Document
QUESTIONS
ANSWERS
table created.
desc student;
Table altered
desc student;
3. alter table student modify address varchar(20);
Table altered
desc student;
Table altered
desc student;
Table altered
desc student;
6. alter table student rename to student1;
Table altered
desc student;
table dropped
DML
QUESTIONS
6. Display the name and designation of all employees whose department is ‘cse’
7. Display the details of all employees whose name ends with ‘a’.
10. Remove the details of employees whose salary is between 5000 and 7500.
11. Change the designation of all employees to asst manager whose current designation is executive
and who have joined before 1st Jan 2011
12.Display the name and increment of all employees .Assume 10% of increment.
QUERIES
1. create table employ(empid number(5),ename varchar(10),eaddr varchar(10),designation
varchar(20),dept varchar(10),salary number(10),joindate date);
5 rows inserted.
2 rows deleted.
11.
1 row updated
CONSTRAINS
QUESTIONS
1. Create a table department(dept no,dept name,staffno). Set underlined attribute as primary key
at column level.
2. Populate the table with following valueS
D1 S101 CS
D2 S110 EC
D1 S201 EEE
3. Create a table books (title,author). Set underlined attribute as primary key at table level.
4. Populate the table books with following values
Title Author
DBMS NAVATHE
C Dennis Richie
DBMS Korth
5. Create a table library(title,author,no of copies).set title as foriegn key at column level with
respect to table books.
6. Populate table library with following values
C Dennis Richie 5
DBMS Navathe 10
OS Korth 20
10 Aswathy D1
20 Akash D3
30 Arun D2
ACCNO AMT
147 1000
210 5000
777 100
623 5001
QUERIES
1 rows inserted.
1 rows inserted.
Error report -
For Trusted Oracle configured in DBMS MAC mode, you may see
*Action: Either remove the unique restriction or do not insert the key.
1 rows inserted.
1 rows inserted.
Error report -
For Trusted Oracle configured in DBMS MAC mode, you may see
*Action: Either remove the unique restriction or do not insert the key.
1 rows inserted.
1 rows inserted.
Error report -
SQL Error: ORA-02291: integrity constraint (MANEESHA.SYS_C008357) violated - parent key not
found
02291. 00000 - "integrity constraint (%s.%s) violated - parent key not found"
table S1 created.
1 rows inserted.
Error report -
SQL Error: ORA-02291: integrity constraint (MANEESHA.SYS_C008361) violated - parent key not
found
02291. 00000 - "integrity constraint (%s.%s) violated - parent key not found"
1 rows inserted.
Error report -
*Cause: An attempt was made to insert NULL into previously listed objects.
12. create table account(accno number(5) primary key,amt number(20) check (amt>=250));
1 rows inserted.
1 rows inserted.
Error report -
*Cause: The values being inserted do not satisfy the named check
1 rows inserted.
AGGREGATE FUNCTIONS
QUESTIONS
QUERIES
7 rows inserted
1. Find the total number of accounts segregated on the basis of account type per branch
2. Find out the customer having more than one account type in the bank
3. Find out the number of accounts opened in each branch after 3/01/2015 only if the number of
accounts opened after 3/01/2015 exceed 1
5. Find out number of accounts at each branch in the order of branch number
Queries
Questions
1. Find the total number of accounts segregated on the basis of account type per branch
2. Find out the customer having more than one account type in the bank
3. Find out the number of accounts opened in each branch after 3/01/2015 only if the number of
accounts opened after 3/01/2015 exceed 1
5. Find out number of accounts at each branch in the order of branch number
Queries
QUESTIONS
8. List the name of publishers which have got entry either in book_details or publisher table.
9. List the name of publisher which have got entry in both tables.
10. List the name of publisher that have got entry in book_details but not in publisher table.
QUERIES
10. select publisher_name from book_detail minus select publisher_name from publisher;
VIEWS
QUESTIONS
4. List the pname and country of all products whose category is ‘home appliances’ using views.
12. Define another view v3 that contains employee id,ename,salary,dept id,and dept name.(Create
appropriate tables).
13. Modify the salary of all employees who belong to dept 10 by rupees 1000.
15. Modify the table to set eid as primary and dept id as foreign key.
QUERIES
2. 5 rows inserted.
view V1 created.
1 rows inserted.
1 rows updated.
view V2 created.
The previous row inserted to views made changes in parent table also. Therefore creating another
view causes fields with null values.
0 rows deleted
create
view v3
as
select
view V3 created.
*Cause: An attempt was made to insert or update columns of a join view which
SQL Error: ORA-01776: cannot modify more than one base table through a join view
01776. 00000 - "cannot modify more than one base table through a join view"
*Cause: Columns belonging to more than one underlying table were either