CREATING DATABASES AND TABLES USING SQL SERVER

you will use the SQL Server named instance SQLSERVERCSU that you created in the Module 1 Critical Thinking Assignment. The objectives of this activity are to configure two new user databases, and to create new tables and a foreign key relationship.
1.Use SQL Server Management Studio to connect to the SQLSERVERCSU instance. Create a new user database with the name HandsOnOne using the New Database dialog box from Object Explorer. Use the default database settings with the following exceptions:1.Data file initial size: 40 MB
2.Log file initial size: 15 MB
3.Autogrowth enabled with 15 MB in file growth
4.Unlimited maximum file size

2.Use Object Explorer to generate a CREATE DATABASE script from the HandsOnOne database in a new Query Editor window. Change the name of the database in the SQL script to HandsOnTwo and modify the data file initial size to 35 MB. Execute the SQL script to create the database named HandsOnTwo.
3.Using either Object Explorer or Query Editor, set the recovery mode for the HandsOnOne database to full. Set the recovery mode for the HandsOnTwo database to simple. Document this step by taking a screenshot of the options page in the database properties window for each database.
4.Using Object Explorer—or by running a SQL command in the Query Editor window—rename the HandsOnTwo database to HandsOnTwo_Delete.
5.Execute a SQL command to DROP the HandsOnTwo_Delete database.
6.Using Object Explorer, create a new table named Customer with the following column names, associated data types, and constraints:

Column name

Data type

Constraint

CustomerID

int

Primary key

CustomerName

nvarchar(40)

Not null

CustomerAddressID

int

Not null

Take a screenshot of the Table Designer window to document this step.
7.Using Query Editor, construct and execute a SQL command to create a new table named Address with the following column names, associated data types, and constraints:

Column name

Data type

Constraint

AddressID

int

Primary key

Street

nvarchar(50)

Not null

City

nvarchar(40)

Not null

State

char(2)

Not null

ZipCode

nvarchar(10)

Not null

After executing the SQL command, document this step by taking a screenshot of the Query Editor window to show that the query completed successfully.
8.Using Object Explorer, create a foreign key relationship between the Customer and Address tables. The AddressID of the Address table is the primary key, and the CustomerAddressID of the Customer table is the foreign key. After creating the key, view the dependencies of the Address table in Object Explorer and take a screenshot to document this step.
9.Reflect on what worked well and which steps you struggled with in a one page paper that follows the CSU-Global Guide to Writing and APA Requirements.

Combine the four appropriately labeled screenshots and the writing assignment into a single MS Word document, and upload it to the assignment page.

Leave a Reply