A SELECT FROM Employees WHERE Salary20000 B SELECT FROM Employees WHERE

# A select from employees where salary20000 b select

This preview shows page 10 - 12 out of 13 pages.

A. SELECT * FROM Employees WHERE Salary>20000 B. SELECT * FROM Employees WHERE Salary>'20000' C. SELECT * FROM Employees WHERE Salary>'\$20000' D. SELECT * FROM Employees WHERE Salary>\$20000 Answer: A Explanation: In order to accomplish the task, Andrew will use the following script: SELECT * FROM Employees WHERE Salary>20000 When a query is created with the Currency datatype in the WHERE clause, the value of the currency datatype must be a number. The number must be neither enclosed in single or double quotes nor prefixed by a dollar or other currency signs. QUESTION: 133 Andrew works as a Database Administrator for Softech Inc. The company has a database named Sales. The database contains a table named SalesData. Andrew wants to ensure that multiple columns in the table do not contain duplicate values, and each column should allow a single NULL value. Which of the following constraints will he use to accomplish the task? 96
A. FOREIGN KEY B. UNIQUE C. CHECK D. PRIMARY KEY Answer: B Explanation: In order to accomplish the task, Andrew will use the UNIQUE CONSTRAINT. The UNIQUE CONSTRAINT does not allow duplicate values. It can be implemented on multiple columns in a table. Since UNIQUE CONSTRAINT does not allow duplicate values, it allows only a single NULL value in the columns on which it is implemented. UNIQUE constraint ensures that no two rows have duplicate values in a specified column or set of columns. Multiple UNIQUE constraints can be defined for a table. The UNIQUE constraint can be created while creating a table, using the CREATE TABLE statement. It can also be created while modifying the table, using the ALTER TABLE statement. The UNIQUE constraint allows NULL values unless the NOT NULL constraint is specified for the same column. Answer D is incorrect. The PRIMARY KEY CONSTRAINT does not allow duplicate values and NULL values in a column on which it is defined. The PRIMARY KEY CONSTRAINT can be implemented only on a single column in a table. A table usually has a column or combination of columns whose values uniquely identify each row in the table. This column (or columns) is called the primary key. Primary key ensures that no duplicate or null values are entered in the column (or columns) defined as primary key columns. This enforces integrity of the table. A primary key can be created by defining a primary key constraint while creating or altering a table. A table can have only one primary key constraint. As primary key constraints ensure uniqueness, they are often defined by using an identity column. Answer C is incorrect. The CHECK CONSTRAINT can be used to check for the insertion of only valid values in a column. It can be applied on multiple columns to check the entry of valid values. The CHECK constraint enforces domain integrity by limiting the values that are accepted by a column. Multiple CHECK constraints can be applied to a column. A CHECK constraint can be created using a logical expression to validate the value accepted by a column. It is also possible to use multiple-columns in a CHECK constraint. For example,

#### You've reached the end of your free preview.

Want to read all 13 pages?

• Fall '20
• Foreign key, Microsoft Office 2007