Priori Infotech Confiden al
1. We have SRC_USER_DETAILS and TGT_USER_DETAILS if SRC_USER_ID value is not present in
target table then records should be inserted in target table and if SRC_USER_ID is present
then then TGT_USER_ADDRESS AND TGT_USER_CONTACT_DETAILS should update.
Refer the below table structure.
SRC_USER_DETAILS
SRC_USER_I SR SRC_USER_ADDRES
D _USER_NAME S SRC_USER_CONTACT_DETTAILS
101 KUMAR PUNE 9862534512
102 ANKIT MUMBAI 9965327845
105 RAMESH DELHI 8798655412
TGT_USER_DETAILS
TGT_USER_I TGT_USER_NAM TGT_USER_ADDRES
D E S TGT_USER_CONTACT_DETTAILS
Note: Use Merge statement.
2. List out the type of constraint in oracle?
3. Note down the difference between PRIMARY KEY constraint and UNIQUE KEY constraint.
4. Execute given queries on below table and check the difference between these queries in
detail.
SRC_USER_DETAILS
SRC_USER_I SR SRC_USER_ADDRES
D _USER_NAME S SRC_USER_CONTACT_DETTAILS
101 KUMAR PUNE 9862534512
105 ANKIT MUMBAI 9965327845
105 RAMESH DELHI 8798655412
101 MOHAN PUNE 9862534512
102 ANKIT MUMBAI 9965327845
105 SUDHIR DELHI 8798655412
101 HARI PUNE 9862534512
102 ABHILASH MUMBAI 9965327845
105 RAMESH DELHI 8798655412
⮚ SELECT DISTINCT src_user_id FROM src_user_details;
⮚ SELECT DISTINCT src_user_id,src_user_name FROM src_user_details;
⮚ SELECT src_user_id, src_user_name, src_user_address, src_user_contact_details FROM
src_user_details ORDER BY src_user_id;
⮚ SELECT src_user_id, src_user_name, src_user_address, src_user_contact_details FROM
src_user_details ORDER BY src_user_id,src_user_name ;
⮚ SELECT src_user_id, src_user_name, src_user_address, src_user_contact_details FROM
src_user_details ORDER BY src_user_name;
Priori Infotech Confiden al
Priori Infotech Confiden al
⮚ SELECT src_user_id,src_user_name FROM src_user_details ORDER BY src_user_name,
src_user_id ;
⮚ SELECT src_user_id,src_user_name FROM src_user_details ORDER BY src_user_name,
src_user_address ;
⮚ SELECT DISTINCT src_user_id, src_user_name, src_user_address, src_user_contact_details
FROM src_user_details ORDER BY src_user_id,src_user_name ;
⮚ SELECT DISTINCT src_user_id, src_user_name, src_user_address, src_user_contact_details
FROM src_user_details ORDER BY src_user_name;
⮚ SELECT DISTINCT src_user_id, src_user_name, src_user_address, src_user_contact_details
FROM src_user_details ORDER BY src_user_contact_details desc;
⮚ SELECT DISTINCT src_user_id, src_user_name, src_user_address, src_user_contact_details
FROM src_user_details ORDER BY src_user_contact_details desc, src_user_name asc;
5. Create below table with primary key on TGR_USER_ID column.
TGT_USER_DETAILS
TGT_USER_I TGT_USER_NAM TGT_USER_ADDRES
D E S TGT_USER_CONTACT_DETTAILS
And insert some values in it.
6. Create below table with primary key on TGR_USER_ID and TGT_USER_NAME column.
And insert some values in it.
TGT_USER_DETAILS_1
TGT_USER_I TGT_USER_NAM TGT_USER_ADDRES
D E S TGT_USER_CONTACT_DETTAILS
7. Write a query to select unique records only from table?
8. What is the ROWID and ROWNUM explain it with the help of example?
9. Write a query to get first 3 records from table?
10. Write query to add PRIMARY KEY constraint to exis ng table?
11. What is foreign key constraint explain with the help example?
12. How to create empty tables with the same structure as another table?
13. Write a query to display the current date?
14. Write a query to display the current date and me?
15. Explain the IN and NOT IN clause with the help of example?
Eg.SELECT * FROM students where ROLL_NO IN (8,15,25);
Priori Infotech Confiden al
Priori Infotech Confiden al
Priori Infotech Confiden al