0% found this document useful (0 votes)
15 views7 pages

B. Since A View Does Not Hold Data, It Returns Data On The Fly Using The SELECT Statement Stored Inside It

The document contains a series of SQL-related questions and answers covering topics such as views, integrity constraints, triggers, composite keys, subqueries, and normalization. It also includes explanations of SQL concepts like temporary tables, data types, and query clauses. Additionally, it outlines specific SQL functions and their expected outputs.

Uploaded by

mastercottage7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views7 pages

B. Since A View Does Not Hold Data, It Returns Data On The Fly Using The SELECT Statement Stored Inside It

The document contains a series of SQL-related questions and answers covering topics such as views, integrity constraints, triggers, composite keys, subqueries, and normalization. It also includes explanations of SQL concepts like temporary tables, data types, and query clauses. Additionally, it outlines specific SQL functions and their expected outputs.

Uploaded by

mastercottage7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

1. Why does a view always returns current data?

A. Since SQL Server optimizes a view before saving it as an object


B. Since a view does not hold data, it returns data on the fly using the SELECT
statement stored inside it
C. Since a view is always indexed
D. Since a view is always recompiled whenever new data is inserted into the base
tables
Answer: B

2. You created a view with SCHEMABINDING option. The view selects TarineeId,
TraineeName, CourseID, TraineeAge columns from Trainees table. Now you want to
dropTraineeAge column from the Trainees table. How can you do that?
A. use ALTER TABLE statement with NO CHECK option
B. drop the schema-bound view and then drop the column using ALTER TABLE
statement
C. drop the whole table and then recreate it
D. delete existing data from the table and then drop the column using ALTER TABLE
statement
Answer: B

3. Which one cannot be used as the first character of an identifier?


A. A letter
B. A number
C. An underscore sign (_)
D. An at sign (@)
ANS:B

4. What is the maximum number of columns a table can have?


A. 255
B. 1024
C. 8000
D. Unlimited
Answer: B

Q5. Which type of integrity a foreign key enforces?


A. Domain integrity
B. Entity integrity
C. Referential integrity
D. Enterprise integrity
Answer: C

Q6. Which one defines a statement block?


A. START... END
B. BEGIN... END
C. (...)
D. [...]
Answer: B

Q7. How do you create a temporary table?


A. By creating the table in tempdb system database
B. By putting the single or double number signs (#) at the beginning of the table name
C. By putting an at sign (@) at the beginning of the table name
D. By adding temp prefix to the table name
Answer: B

Q8. The application software on the client uses data that's stored on the database using
____________. Which one best fits the blank space?
A. a data access API
B. SQL queries
C. a database management system
D. Network
Answer: A
Q9.. What is a trigger?
A. A predefined select query that's stored in a database 7
B. A set of statements, not limited to only one select statement, stored as an object
C. A special type of procedure that can return a value or a table
D. a special type of procedure that's executed when rows are inserted, updated, or
deleted from a table or when the definition of a database is changed
Answer:D

Q10. Which one is true for a Composite key?


A. A column uniquely to identify a row in a table
B. More than one column to uniquely identify a row in a table
C. A column uniquely to identify a set of rows in a table
D. More than one column to uniquely identify a set of rows in a table
Answer: B

Q11. How do you implement a one-to-many relation?


A. add a primary key column to the table on the "many" side of the relationship
B. add a composite key column to the table on the "many" side of the relationship
C. add a foreign key column to the table on the "one" side of the relationship
D. add a foreign key column to the table on the "many" side of the relationship
Answer: D

Q12. Which SQL Server extension clause lets you create a new table based on the result
set defined by the SELECT statement?
A. FETCH NEXT
B. INTO
C. TOP
D. OVER
Answer: B
13. Why must column names be unique when you create tables using the SELECT INTO
statement?

• Since the new table is based on the columns in the result set returned by the SELECT
statement
• Since the new table will generate random names for the column
• Since new table will ignore duplicate columns
• Otherwise data is not copied correctly

Q14. Which data types store strings of Unicode characters?

• Char and varchar


• Text and ntext
• Nchar and nvarchar
• Text and varbinary
Answer: C

Q15. Which one is not a valid option for using a subquery?

• In a WHERE clause as a search condition


• In the FROM clause as a table specification
• In the SELECT clause as a column specification
• In a ORDER BY clause as a sort order specification
Answer: D

Q16. When a subquery can be used anywhere in a SELECT statement where an


expression is allowed?

• When the subquery returns a single value


• When a subquery returns a single column result set with one or more rows
• When a subquery returns a result set with two or more columns
• Above all cases
Answer: A

Q17. Which operator cannot be used when a subquery in WHERE clause returns a list of
values?

• IN
• EXISTS
• ANY
• >
Answer: D

Q18. Which one can you use to check for the existence of an object before running a
create statement?

• EXISTS
• IN
• ALL
• ANY
Answer: A
Q16. Which query or queries will work?

• Select City, Count(CustomerId) AS ‘No. of customers’ FROM Customers GROUP BY


City WHERE Country = ‘Germany’
• Select City, Count(CustomerId) AS ‘No. of customers’ FROM Customers WHERE
Country = ‘Germany’ GROUP BY City
• Select City, Count(CustomerId) AS ‘No. of customers’ FROM Customers GROUP BY
Country, City HAVING Country = ‘Germany’
• Select City, Count(CustomerId) AS ‘No. of customers’ FROM Customers HAVING
Country = ‘Germany’ GROUP BY City
Answer: B

Q17. _________ allow all rows from one or more tables to be included in the resultset.
Select the correct one for the blank.

• Inner joins
• Outer joins
• Cross joins
• Distributed queries
Answer: B

Q18. Which clause of a SELECT statement is used to specify how the result of the query
will be sorted?

• SELECT
• FROM
• WHERE
• ORDER BY
Answer: D

Q19. LIKE ‘%ER’ will match ____________.

• “Computer” and “James Peter”


• “Computer” and “Peter, James”
• “Using Computer” and “Computer World”
• “Computer1” and “Computer2”
Answer: A
Q20. Which one provides a graphical interface to send queries to a particular instance of
SQL Server and view the result of the query sent?
• SQL Server Configuration Manager
• SQLCMD
• SQL Server Management Studio
• SQL Data tools
Answer: C
Q21. You see a table dbo.Product under a database, what does the dbo. quantifier
indicate?
• The Product table belongs to dbo database
• The Product table is in Database Server named dbo
• The Product table copied from the dbo database the the current database
• The Product table belongs to the dbo schema
Answer: D

Q22. What does a single row in a table represent?


• A collection of entries
• One instance of an entity
• An attribute of an entity
• A single value
Answer: B

Q23. The find string is not found in the search string, the CHARINDEX function returns
_______________.
A. 0
B. 1
C. -1
D. Null
Answer:A

Q24. FLOOR (-1.25) returns _______


A. -1
B. -2
C. -1.3
D. -1.4
Answer: B

*** What is sequence?


= A sequence is a object that generates a sequence of numeric values.

*** What is recursive query?


= A recursive query that continuously references a previous result until it returns an empty
result.

*** Three rules of 3NF?


= 1NF> A single cell cannot hold multiple values. It must hold only a single-valued attribute.
2NF> Every none key column must depends on the primary key.
3NF> Every none key column must depends on 'only' the primary key.

You might also like