1. What are the grouping function in SQL ?

2. If base table of a view deleted means, what will happen
while we querying on view ? will give any error ?

3. Difference between DROP, DELETE, TRUNCATE table ?

4. What is constraints and types ?

5. What is max size of nchar & nvarchar ?

6. Define ROLLBACK, COMMIT, SAVE POINT

7. How non-clustered better ? or rank the Clustered,
Non-Clustered and Table scan in performance wise

8. Select 10 rows from a table ?

9. Define DML, DDL, DCL, DTL commands ?

10. What is mean by NULL value ? NULL means "" or 0 or
undefined ?

11. Default constraints ?

12. Can we have more then primary Key in table ?

13. Type of integrity ? Entity, Referential, Domain ?

Answers were Sorted based on User's Feedback



1. What are the grouping function in SQL ? 2. If base table of a view deleted means, what will ha..

Answer / srivas

What is the difference between DROP,DELETE,TRUNCATE table ?
Delete:It's an DML command which is used for deleting
particular table in the database...even though we delete the
data we can regain it by rollback command.

Example:SQL> SELECT COUNT(*) FROM emp;

COUNT(*)
----------
14

SQL> DELESQL> SELECT COUNT(*) FROM emp;

COUNT(*)
----------
14

SQL> DELETE FROM emp WHERE job = 'CLERK';

4 rows deleted.

SQL> COMMIT;

Commit complete.

Truncate:This command is a DDL Command which is used to
delete a table...I Just Conclude it as
Truncate=Delete+Commit...once u applied this on table u
can't get the data back...but the structure will be there..

Example:

SQL> TRUNCATE TABLE emp;

Table truncated.

SQL> SELECT COUNT(*) FROM emp;

COUNT(*)
----------
0

Drop:It is used to destroy entire structure of a
table...once we apply this command on any particular table
we can't get it in anyway...so be cautious while applying
this command.

Example:

SQL> DROP TABLE emp;

Table dropped.

SQL> SELECT * FROM emp;
SELECT * FROM emp
*
ERROR at line 1:
ORA-00942: table or view does not exist

Is This Answer Correct ?    11 Yes 3 No

1. What are the grouping function in SQL ? 2. If base table of a view deleted means, what will ha..

Answer / mohammad ali

DML

DML is abbreviation of Data Manipulation Language. It is used to retrieve, store, modify, delete, insert and update data in database.

Examples: SELECT, UPDATE, INSERT statements

DDL

DDL is abbreviation of Data Definition Language. It is used to create and modify the structure of database objects in database.

Examples: CREATE, ALTER, DROP statements

DCL

DCL is abbreviation of Data Control Language. It is used to create roles, permissions, and referential integrity as well it is used to control access to database by securing it.

Examples: GRANT, REVOKE statements

TCL

TCL is abbreviation of Transactional Control Language. It is used to manage different transactions occurring within a database.

Examples: COMMIT, ROLLBACK statements

The DELETE command is used to remove rows from a table. A WHERE clause can be used to only remove some rows. If no WHERE condition is specified, all rows will be removed. After performing a DELETE operation you need to
COMMIT or ROLLBACK the transaction to make the change permanent or to undo it.

TRUNCATE removes all rows from a table. The operation cannot be rolled back. As such, TRUCATE is faster and doesn't use as much undo space as a DELETE.

The DROP command removes a table from the database. All the tables' rows,
indexes and privileges will also be removed. The operation cannot be rolled back.

DROP and TRUNCATE are DDL commands, whereas DELETE is a DML command. Therefore DELETE operations can be rolled back (undone), while DROP and TRUNCATE operations cannot be rolled back.

Is This Answer Correct ?    4 Yes 0 No

1. What are the grouping function in SQL ? 2. If base table of a view deleted means, what will ha..

Answer / srivas

Select 10 rows from a table ?

Answer : Use TOP keyword to select 10 rows from a table.

Is This Answer Correct ?    4 Yes 2 No

1. What are the grouping function in SQL ? 2. If base table of a view deleted means, what will ha..

Answer / sonia

10) Null is not equal to "" or 0. it is un identified value
means suppose there is column Phone number.
If we do not any phone number we can insert NULL.
"" means empty String.
Select * from table where roll=""(EMPTY)
select * from table where roll is NULL(UNDEFINED)

2) Correct Answer.
View is made up of base tables. Suppose we select data from
two table table1 & table2 ,these are base tables.
He wants to ask u if we drop a table table2,Will view give
error.
Yes.But if we recreate the table we can query the view
again.

Try it by urself--
First create the view by selecting the data from two tables
then select columns from view
Suppose select * from view1
then drop one of the tables
then select * from view1 gives error.


12) NO.


13) ENTITY INTEGRITY--We cannit insert null in a parimary
key. CZ if two columns have tha value we cannot distinguish
b/w two rows.

REFERENTIAL INTEGRITY---Vales in foregn key table are only
those that match a value in a primary key table.

DOMAIN CONSTRAINT--A unique value for a column.
Exampl--Empid

Is This Answer Correct ?    2 Yes 0 No

1. What are the grouping function in SQL ? 2. If base table of a view deleted means, what will ha..

Answer / dinesh sharma

RollBack Mean Transaction is Rolled Back to That State me
undo The Thing That we Have Done

Commit Mean Transaction is Commited to that state me the
the thing we have done is save

SavePoint is Concept of ORacle mean
For A Long Transaction we have Declare save point
intermediate so that the transction before savepoint is
commited .

Is This Answer Correct ?    2 Yes 0 No

1. What are the grouping function in SQL ? 2. If base table of a view deleted means, what will ha..

Answer / srivas

Can we have more then primary Key in table ?

Answer : We can't use more than one Primary key in a
table because Primary key is Unique Value.

Is This Answer Correct ?    6 Yes 5 No

1. What are the grouping function in SQL ? 2. If base table of a view deleted means, what will ha..

Answer / ramesh babu

4) It is used to enforce a set of rules in the database
table. It used to limit the data that can go into
table.
Five type of constraints
Primary key
Unique Key
Foreign Key
Not Null
Check


5) nchar [ ( n ) ]
Fixed-length Unicode character data of n characters. n must
be a value from 1 through 4,000. The storage size is two
times n bytes.

nvarchar [ ( n | max ) ]
Variable-length Unicode character data. n can be a value
from 1 through 4,000. max indicates that the maximum
storage size is 2^31-1 bytes.

9) DML

DML is abbreviation of Data Manipulation Language. It is
used to retrieve, store, modify, delete, insert and update
data in database.

Examples: SELECT, UPDATE, INSERT statements

DDL

DDL is abbreviation of Data Definition Language. It is used
to create the structure of database objects in
database.

Examples: CREATE, ALTER, DROP statements

DCL

DCL is abbreviation of Data Control Language. It is used to
create roles, permissions, and referential integrity as
well
it is used to control access to database by securing it.

Examples: GRANT, REVOKE statements

TCL

TCL is abbreviation of Transactional Control Language. It
is
used to manage different transactions occurring within a
database.

Examples: COMMIT, ROLLBACK statements

11) The DEFAULT constraint is used to insert a default
value into a column.The default value will be added to all
new records, if no other value is specified.
Ex:CREATE TABLE Persons
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255) DEFAULT 'Chennai'
)

12)No

Is This Answer Correct ?    1 Yes 0 No

1. What are the grouping function in SQL ? 2. If base table of a view deleted means, what will ha..

Answer / laxman

What are the grouping function in SQL ?

Grouping functions are:
max()
min()
sum()
avg()

Select 10 rows from a table ?
select * from table_name where count(*) <=10
or

select top 10 from table _name

10. What is mean by NULL value ? NULL means "" or 0 or
undefined ?

Null is not equal to "" or 0. it is un identified value

12. Can we have more then primary Key in table ?
no, we can't.

2. If base table of a view deleted means, what will happen
while we querying on view ? will give any error ?

i dont know exactly. but it likely base table doesnt exists.

4. What is constraints and types ?
types:
primary key
foreign key
not null
unique
defaults
check
rule

Is This Answer Correct ?    1 Yes 3 No

1. What are the grouping function in SQL ? 2. If base table of a view deleted means, what will ha..

Answer / apparao akki

For 10 records..


SQL> Select * from Emp where rownum<=10;

/

Is This Answer Correct ?    0 Yes 3 No

1. What are the grouping function in SQL ? 2. If base table of a view deleted means, what will ha..

Answer / srivas

What is mean by NULL value ?NULL means "" or 0 or
undefined ?

Answer : NULL means empty ie. ""

Is This Answer Correct ?    5 Yes 10 No

Post New Answer

More SQL Server Interview Questions

What is the new security features added in sql server 2014? : sql server security

0 Answers  


You have developed an application which uses many stored procedures and triggers to update various tables users ocassionally get locking problems which tool is best suited to help you diagnose the problem?

0 Answers  


Do you know what are acid properties of transaction?

0 Answers  


What is a table called, if it does not have neither Cluster nor Non-cluster Index?

2 Answers  


What are the differences between triggers and stored procedures?

0 Answers  






Sql studio em braces a variety of capabilities, but will I need them all? Is there a simpler product ? : sql server management studio

0 Answers  


How do we get current date in SQL Server 2000, Oracle, MS Access?

13 Answers  


when would you go for denormalization? : Sql server database administration

0 Answers  


When do u use clustered index and non-clustered index?

3 Answers   IBM,


difference between function and procedure

3 Answers   Cognizant, HCL, TCS, Theorem,


what is the out put of below queries? a. select * from Emp where null = null; b. select * from Emp where 1=1;

13 Answers   Patni,


What is the difference between having and where clause?

4 Answers  


Categories