Database Tables  «Prev  Next»

SQL Server Databases - Quiz

Each question is worth one point. Select the best answer for each question.
1. John is trying to modify a database, but he keeps getting an error. He double-checks the syntax of the ALTER DATABASE statement, but still cannot modify the database. What is the most likely cause of the problem?
Please select the best answer.
  A. ALTER DATABASE is not the correct statement.
  B. Transact-SQL cannot be used to modify a database; John should be using SQL Server Management Studio (SSMS) instead.
  C. Because the syntax can be tricky, John needs to check it again to find the problem.
  D. John does not have the correct permissions to modify a database.

2. Mary has a database that is currently 5 MB, with a log file also of 5 MB. What will happen when Mary issues the following Transact-SQL statement? ALTER DATABASE employee MODIFY FILE (NAME = employee_log, SIZE = 2MB)
Please select the best answer.
  A. An error will occur.
  B. The database will be altered to a size of 2 megabytes.
  C. The transaction log will be altered to a size of 2 megabytes.
  D. A new database named "employee" will be created.

3. What can you NOT do when you use the CREATE DATABASE Transact-SQL statement?
Please select the best answer.
  A. Create a database named "sales" with a primary data file size of 50 megabytes and a transaction-log size of 50 megabytes.
  B. Create a database named "sales" and a database named "inventory" in the same statement.
  C. Specify a database growth increment of 12%.
  D. Alter the default database file locations.

4. A DBA has the SalesDB.mdf and SalesDB_log.ldf files from a database that was cleanly detached from another SQL Server instance. Both files are intact and reachable on the new server, but no backup (.bak) file exists anywhere. Which statement correctly brings this database onto the new instance, using exactly what the DBA has on hand?
Please select the best answer.
  A. RESTORE DATABASE SalesDB FROM DISK = N'C:\SalesDB.mdf';
  B. CREATE DATABASE SalesDB ON (FILENAME = N'C:\SQLData\SalesDB.mdf'), (FILENAME = N'C:\SQLLogs\SalesDB_log.ldf') FOR ATTACH;
  C. CREATE DATABASE SalesDB;, then manually re-enter the data row by row.
  D. ALTER DATABASE SalesDB SET ONLINE;

5. A developer runs CREATE DATABASE TrainingDB ON PRIMARY (NAME = TrainingDB_Data, FILENAME = 'C:\SQLData\TrainingDB.mdf', SIZE = 100MB) LOG ON (NAME = TrainingDB_Log, FILENAME = 'C:\SQLData\TrainingDB.ldf', SIZE = 25MB); on a server where the folder C:\SQLData does not yet exist. What happens?
Please select the best answer.
  A. SQL Server creates the C:\SQLData folder automatically, then creates the database normally.
  B. The statement fails with an error, because SQL Server will not create a missing folder on its own.
  C. SQL Server silently creates the database in the instance's default data directory instead, ignoring the FILENAME path given.
  D. The statement succeeds, but the database is left offline until the folder is created by hand.