Final Viva
Final Viva
Viva Questions:
1.What happens if you omit the WHERE clause in the UPDATE statement?
5.Suppose a Student column has two columns, Name and Marks. How to get
name and marks of top three students.
SELECT Name, Marks FROM Student s1 where 3 <= (SELECT COUNT(*) FROM
Students s2 WHERE s1.marks = s2.marks)
NOT NULL
UNIQUE
PRIMARY KEY
FOREIGN KEY
CHECK
DEFAULT
2.Create a table and insert the values in table?
Create Table:
SQl>createtableship(shipidNUMBER,shipnameVARCHAR2(10),originVARCHAR2(1
5),destination VARCHAR2(15),passenger NUMBER);
Insert querry:
SQL> INSERT INTO ship VALUES(101, 'titanic', 'america', 'canada', 528);
1 row created.
SQL> INSERT INTO ship VALUES(102, 'alligator', 'america', 'africa', 524);
1 row created.
SQL> INSERT INTO ship VALUES(103, 'cairo', 'german', 'india', 628);
1 row created.
NOT NULL
UNIQUE
PRIMARY KEY
FOREIGN KEY
CHECK
DEFAULT
Create Table:
SQl>createtableship(shipidNUMBER,shipnameVARCHAR2(10),orignVARCHAR2(15
),
destination VARCHAR2(15),passenger NUMBER);
Insert querry:
SQL> INSERT INTO ship VALUES(101, 'Titanic', 'America', 'Canada', 528);
1 row created.
1. display the student id, student name and department of the student whose
the semester in between 5 and 6
4. Write an SQL Query to print the name of the distinct employee whose
DOB is between 01/01/1960 to 31/12/1975.
Answer: This SQL query is tricky, but you can use BETWEEN clause to get
all records whose date fall between two dates.
2. Define COMMIT ?
Ans. COMMIT saves all changes made by DML statements.
3. What is a transaction?
Ans. A transaction is a sequence of code that runs against a database. It
takes database from one consistent state to another.
SET OPERATIONS
Viva Questions:
Viva Questions:
1. What is a View?
Ans. A view is a virtual table which contains data from one or more tables. Views
restrict data access of table by selecting only required values and make complex
queries easy.
3. Define Normalization Ans. The process of table design to minimize the data
redundancy is called normalization. We need to divide a database into two or more
table and define relationships between them.
TRIGGER
Viva Questions:
1. What is Trigger?
Ans. Trigger allows us to execute a batch of SQL code when a table event
occurs (Insert, update or delete command executed against a specific table)
2. 25. Write an SQL Query to find name of employee whose name Start with
‘M’
Answer :
a.
SELECT * FROM Employees WHERE EmpName like 'M%';.
Unique key is same as primary with the difference being the existence of null.
Unique key field allows one value as NULL value.
4. What is Atomicity?
Answer :
Atomicity of a transaction is nothing but in a transaction either all operations
can be done or all operation can be undone, but some operations are done
and some operation are undone should not occur.
5. What is Consistency?
Answer :
Consistency means, after a transaction completed with successful, the data
in the data store should be a reliable data this reliable data is also called as
consistent data.
6. What is Isolation?
Answer :
Isolation means, if two transactions are going on same data then one
transaction will not disturb another transaction.
7. What is Durability?
Answer :
Durability means, after a transaction is completed the data in the
data store will be permanent until another transaction is going to be
performed on that data.