Day 8

Quiz

1:In the following code, what will the database size be increased to the first time it runs out of allocated space?
CREATE DATABASE Customer
  ON
  (NAME = cust_dat,
  FILENAME = 'c: SQL_Data custdat.mdf',
  SIZE = 100MB,  MAXSIZE = 500MB,
  FILEGROWTH = 20MB)

A1: The initial size starts at 100MB. When that 100MB is used up, the database will automatically increase 20MB to 120MB.
2:What would happen if you tried to insert the value 123abc into a column defined with a data type of INTEGER?
A2: The record would not be inserted. The SQL server would return an invalid data type error.
3:How many primary keys can you have per table?
A3: One.

Exercises

1:Write the code to create a table with the following columns and specifications:
A1: Call the new table "employees2," and add columns for peoples'names as first, middle, and last; allow NULLS for the middle name only.
CREATE TABLE employees2
  (first varchar(15) NOT NULL,
  middle varchar(15) NULL,
  last varchar(20) NOT NULL)

2:Now write the code to add a four-digit, numbers-only column called emp_number to the table in exercise 1.
A2:
ALTER TABLE employees
  ADD emp_number INT

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset