Q 1 >
Which of the following is the correct order for SQL CREATE TABLE statements?
1> Create table tablename ( col1 datatype1, col2 datatype 2,.. )
2> Create tablename (col1 datatype1 ,col2 datatype2, …)
3> Create table tablename col1 datatype1 , col2 datatyp2 ,..
4> Create tablename col1 datatype1 , col2 datatyp2 ,..
Answer
Q 2 >
What is missing in T-SQL statement ?
Create table employee ( EmpId ,EmpName , EmpCode) ;
1>Datatypes
2> Constraints
3> 1 & 2
4> none
Answer
Q 3 >
Which of the following is the correct to create a primary key on OrderId column in CREATE TABLE statements?
1>Create table Orders ( OrderId Int Primary key , OrderName varchar(50),..)
2> Create table Orders ( OrderId Int add primary key, OrderName varchar(50),..)
3> Create table Orders ( OrderId Int , OrderName varchar(50), Primary key (Orderid))
4> 1 & 3
Answer
Q 4 >
Which of the following is the correct to create a Foreign key in CREATE TABLE statements?
1>
CREATE TABLE tablename
( col1 datatype1 , col2 datatyp2 ,
FOREIGN KEY [col1,col2…] REFERENCES [primary key table name] (column name of primary key table) …
);
2>
CREATE TABLE tablename
( col1 datatype1 , col2 datatyp2 ,
FOREIGN KEY [col1,col2…] [primary key table name] (column name of primary key table) …
);
3>
CREATE TABLE tablename
( col1 datatype1 , col2 datatyp2 ,
FOREIGN KEY [col1,col2…] REFERENCES (column name of primary key table) …
);
4>none
Answer
Q 5 >
Which of the following is the correct to create a SQL Views ?
1>
create view viewname as
select column1, column2 , …..
from tablename where condition ..
2>
create view viewname
select column1, column2 , …..
from tablename where condition ..
3>
create views viewname as
select column1, column2 , …..
from tablename where condition ..
4>
create table view viewname as
select column1, column2 , …..
from tablename where condition ..
Answer
Q 6 >
Which of the following is the correct to create a SQL Stored Procedures?
1>
2>
3>
4> 2 & 3
Answer
Q7 >
What is missing in Create function statement ?
CREATE FUNCTION fn_name
( @parameter1 datatype1, @parameter2 datatype2 , … )
RETURNSdatatype
AS
BEGIN
{expression }
END
1> As after fn_name
2> Return is missing in begin end block
3> 1 & 2
4 > 2
Answer
Q 8 >
Which of the following is the correct to create a SQL Server Database ?
1> create databasename ;
2> create database databasename ;
3> create db databasename;
4> 2 & 3
Answer
Q 4 >
Which of the following is the correct to create a User Defined Table Type Statement?
1>
Create Type tablename as Table
(
col1 datatype1,
col2 datatype2,
.
)
2 >
Create Type tablename
(
col1 datatype1,
col2 datatype2,
.
)
3>
Create Type tablename as
(
col1 datatype1,
col2 datatype2,
.
)
4 > none
Answer
Also Read.
Sql Server Interview Q & A quiz on Select statement
Sql Server Interview Q & A quiz on Substring()