SQL Server Database Fundamentals

Covers SQL Server data types, functions, security roles, indexing, performance tuning, and core SQL operations for database developers and administrators.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

You want to track date and time of the last write access (INSERT, UPDATE) per row. How can you achieve that?

  1. Add a TIMESTAMP column to the table; SQL Server will automatically track date and time of every change.
  2. Add a DATETIME column to the table and assign getdate() as the default value.
  3. Add a DATETIME column to the table and write a trigger that sets its value.
  4. Add a UNIQUEIDENTIFIER column to the table and use it with SQL Server's built functions
Question 2 Multiple Choice (Single Answer)

What is the result of the following statement: select cast(floor(cast(@MyDateTime as float)) as datetime)

  1. Next Sunday relative to @MyDateTime
  2. Only date part of @MyDateTime
  3. Only time part of @MyDateTime
  4. Doesn't work because you cannot cast float to datetime
Question 3 Multiple Choice (Single Answer)

Which classes from the .NET Framework can be used in SQLCLR assemblies with permission set SAFE?

  1. All of them. Permission set SAFE just restricts the use of unmanaged code
  2. None. To use classes from the .NET Framework in SQL Server you need at least permission set EXTERNAL
  3. Some of them are tested specifically for the use within SQL Server, they can be used
  4. Permission sets have nothing to do with SQLCLR
Question 4 Multiple Choice (Single Answer)

How long does it approximately take to create a snapshot of a 100GB database on a state-of-the-art Quadcore server using RAID 5?

  1. A few seconds
  2. Approximately 5 minutes
  3. Usually approximately one hour; depends on the load on the server
  4. More than one hour but it is running in the background
Question 5 Multiple Choice (Single Answer)

What was a problem with navigational data access languages?

  1. The user had to have knowledge of the table and index structures
  2. Navigational data access was far slower than declarative access.
  3. Navigational access languages required the coder to embed their queries inside a procedural language shell.
  4. Navigational languages were far slower then SQL
Question 6 Multiple Choice (Single Answer)

Which is a major problem with SQL?

  1. SQL cannot support object-orientation
  2. The same query can be written in many ways, each with vastly different execution plans.
  3. SQL syntax is too difficult for non-computer professionals to use
  4. SQL creates excessive locks within the database
Question 7 Multiple Choice (Single Answer)

Which of the following is an important feature of relational databases and SQL?

  1. Independence of table relationships
  2. High speed of SQL
  3. Powerful GUI front-end
  4. Easy to install and use
Question 8 Multiple Choice (Single Answer)

Which of the following is an important consideration when tuning an SQL statement?

  1. The number of CPUs on the server
  2. The degree of parallelism on the tables
  3. The use of bitmap indexes
  4. The quality of the SQL optimization
Question 9 Multiple Choice (Single Answer)

Which of the following database design features is most important to SQL performance?

  1. Removal of data redundancy
  2. The introduction of data redundancy
  3. The introduction of non-first normal form relations
  4. The introduction of SQL*Plus
Question 10 Multiple Choice (Multiple Answers)

Index will not be used if ... Choose all that apply.

  1. NOT operator is used in the predicate
  2. IN Operator is used in the predicate
  3. Expression and/or functions are used on the indexed columns
  4. Predicate is skipped. However, the SELECT clause has indexed columns
  5. ORDER BY clause has NULL columns. However, NON UNIQUE index exists
Question 11 Multiple Choice (Single Answer)

Which of the following conditions will you use in a WHERE clause to select all last names that start with S?

  1. WHERE LastName = 'S*'
  2. WHERE LastName = 'S%'
  3. WHERE LastName LIKE 'S*'
  4. WHERE LastName LIKE 'S%'
Question 12 Multiple Choice (Single Answer)

What is the best data type to store the birthdays of the US Presidents, starting with George Washington's birthday of February 22, 1732?

  1. DATETIME
  2. SMALLDATETIME
  3. INT
  4. VARCHAR
Question 13 Multiple Choice (Single Answer)

Which of the following is NOT a valid description of the public role?

  1. The public role captures all default permissions for users in a database.
  2. The public role cannot be dropped.
  3. The public role is contained in every database, including msdb, tempdb, model, and all user databases except in the master database for security purposes.
  4. The public role cannot have users, groups, or roles assigned to it.
Question 14 Multiple Choice (Single Answer)

What's the maximum value can an INT data type hold?

  1. 2,147,483,647
  2. 2,147,483,648
  3. 4,294,967,295
  4. 4,294,967,296
Question 15 Multiple Choice (Single Answer)

What will be the result of the following SELECT statement SELECT 2000/02/25 + 4

  1. 2000/02/29
  2. 2000/03/01
  3. 44
  4. An error is generated. A DATETIME value and an INT value cannot be added together. Use the DATEADD function for this purpose.
Question 16 Multiple Choice (Single Answer)

What's the earliest date that can be stored in a DATETIME data type?

  1. January 1, 1643
  2. January 1, 1753
  3. January 1, 1863
  4. January 1, 1700
  5. January 1, 1800
  6. January 1, 1900
Question 17 Multiple Choice (Single Answer)

Which of the following fixed database roles can add or remove user IDs?

  1. db_accessadmin
  2. db_securityadmin
  3. db_setupadmin
  4. db_sysadmin
Question 18 Multiple Choice (Single Answer)

Which of the following data types has the least data type precedence?

  1. BIGINT
  2. FLOAT
  3. DECIMAL
  4. MONEY
  5. REAL
  6. NUMERIC
Question 19 Multiple Choice (Single Answer)

What's the maximum number of parameters can a SQL Server 2000 stored procedure have?

  1. 128
  2. 256
  3. 512
  4. 1,024
Question 20 Multiple Choice (Single Answer)

Which part of the following function definition will generate an error?CREATE FUNCTION dbo.Tomorrow ()RETURNS DATETIMEASBEGIN DECLARE @TodaysDate DATETIME SET @TodaysDate = GETDATE() SET @TodaysDate = DATEADD(DD, DATEDIFF(DD, 0, @TodaysDate), 0) RETURN DATEADD(DD, 1, @TodaysDate)ENDGO

  1. SET @TodaysDate = GETDATE()
  2. SET @TodaysDate = DATEADD(DD, DATEDIFF(DD, 0, @TodaysDate), 0)
  3. RETURN DATEADD(DD, 1, @TodaysDate)
  4. No error is generated. The function will be created.