Sei sulla pagina 1di 2

1.What is the difference between Count() and count (*).

(1 Mark)
Ans: Both will return same output.
Count () will return the no of rows of one column based on the conditions given using the
column given.
Eg. Select count (eid) from employee & Select count ( * ) from employee
Will return same output.

2.What is the basic difference between Foreign Key & Unique Key? (1 Mark).
Ans :
Foreign key : When we use primary key of 1 table in another table then we call that key as
Foreign key.
Unique key is a key or column in any table which contains unique values.
ie. Values in that column cannot be repeated.

3.Explain difference between char and varchar2. (1 Mark)


Ans : Char is data type which defines alphanumeric data with a length between 1 and 255
characters. Once defined it occupies that much length in memory with spaces.
Varchar2 is datatype which defines alphanumeric data that is of variable length; this field
must be between 1 and 2,000 characters long. If string is not filled completely then then
spaces are NOT filled in memory, the length is variable.

4.State difference between DELETE & DROP command with example. (2 Marks)
Ans :
DROP TABLE command deletes a table along with all its data, associated views and indexes.
After this command has been issued, there is no turning back. The most common
use of the DROP TABLE statement is when you have created a table for temporary use.
Syntax : DROP TABLE employee ;

Delete : This command deletes data (row/s) from table. However table still remains there.
You can rollback the changes id those are not saved (not committed).
Syntax : DELETE FROM employee WHERE eID = 4;

1. How the left outer join is different from right outer join? (1 Mark)

Ans: Outer joins are usually come into significance when one of the table is deficient in data.
We use left outer join when the table in right is deficient in data and right outer join when the
left table is deficient in data.

2. What is (1 to 1), (One to many), (Many to many) Relationship. Explain with


examples. (3 Marks)
(NOTE : Below are standard definitions. Marks are given on the basis of appropriate
definition and relevant example.)
a. 1 to 1 - A one to one relationship exists when one entity is related to only one
occurrence in another entity. For example, one Social Security number has only
one owner.
b. 1 to Many – A one to many relationship exists when one entity is related to many
occurrences in another entity. For example, one club has many members.
c. Many to Many – exists when many occurrences in one entity is related to many
occurrences in another entity. For example, 2 parents (Mother and Father) can
have more than 1 children.

3. What is the basic difference between Primary Key & Unique Key? (1 Mark)
a. Primary key: Unique & Null Not Allowed.
b. Unique Key : 1 Null is allowed

4. Give types of joins


a. Cross join
- It is product of all rows from one table to another table & returns those many
rows as output.
- Eg. Select e.name, d.dname from employee e, dept d.

b. Self join
- When we join one table to itself then we call it as self join
- Eg. Select e1. name, e2.mgr_id from employee e1, employee e2
Where e1.eid = e2.eid.

c. Equi join
- When join is based on the conditions of equality then we call it Equi -join.
- Eg. Select e.Ename, d.Dname from employee e, dept d Where e.did = d.did.
d. Non euqi join
e. Outer join ( Left Outer, Right Outer)
f. Inner Join, etc.

5. What is RDBMS
- Relational Database management system, it is a type of DBMS based on
Relational database concepts.

6. Which are DML commands?


- Data manipulation language commands.
- INSERTS, UPDATE, DELETE, ALTER, etc commands are DML commands.
Please revert in case of any queries.

Potrebbero piacerti anche