Database Assignment Solution by stariya

VIEWS: 20 PAGES: 4

									Database Assignment Solution
                                                                                                  M. Drossman

A sample assignment solution for a database class is shown on pages 3 and 4.

How to print database diagram in assignment solution
1. Create database diagram in SQL Server 2005.
2. Capture screen shot into clipboard by pressing CTRL-PRINT SCREEN.
3. Open Paint program that comes with Microsoft operating system and paste screen shot into it.
4. Use the SELECT tool to select the database diagram as shown in Fig. 1.




           Figure 1. Paint program with database screen shot showing database diagram selected.

5. Press CTRL-C to copy the selected database diagram.
6. Position the cursor in the Assignment Solution Word document where you want to place the database
diagram and the press CTRL-V to paste it.

How to print a query in assignment solution
1. Create query in SQL Server 2005.
2. Select the query text by dragging your mouse over it to highlight text.
                                                        1
3. Press CTRL-C to copy the selected text to the clipboard.
4. Position the cursor in the Assignment Solution Word document where you want to place the query text.
5. Press CTRL-V to paste the query text in the Assignment Solution Word document.
6. You may format the text as you would any text in a Word document.

How to print a query result in assignment solution
1. Create the query in SQL Server 2005.
2. Execute the query.
3. Adjust the column widths so that all the data and column headings that you want to show in your
assignment solution are visible.
4. Click the upper left hand corner of the result in the lower pane. The data area background should turn blue
indicating that it has been selected. Alternatively, you can drag your mouse over a portion of the result that
you want to select.
5. Press CTRL-C to copy the selected query result (or part of it) into the clipboard.
6. Position the cursor in your assignment solution Word document where you want to place the query result
and press CTRL-V to paste the query result into the assignment solution.
7. Column headings will not appear but you can create one or more blank lines above the query result and
type them in. Set the font size so the column headings fit within the column width.
8. You can format the text so as to control what is bold or normal font and you can adjust the line spacing as
you want it to appear.

How to print the content of a table
1. Write a query of the form SELECT * FROM tableName; where tableName is the name of the table whose
content you wish to print.
2. Proceed as described above in the section How to print a query result in assignment solution.

Sample assignment solution follows on next page.




                                                       2
ITEC 290        Fall 2008   Assignment 25       Ed Smith 10/29/2008

Assignment: Ch. 21 Exercises 2, 4

Exercise 21.2
a. Database diagram




b. Calendar table content
astart                      aend                          cid   location
2008-09-15 17:00:00.000     2008-09-15 20:00:00.000       2     NYIT, New York City
2008-09-22 15:00:00.000     2008-09-22 19:00:00.000       1     Metropolitan Museum

c. Contacts table content

cid    fname lname street      csz                        tel          cell         spouse children
1      Sam Iam 4 Main St.      Bedford, NY 11345          3418973409   3414569876   Ann Bill, Mary
2      Joan Smith 453 5th Ave. New York, NY               2125832405   9173411600   NULL NULL

                                                      3
Exercise 21.4

Appointments Query

SELECT          DATENAME(mm, astart)+ ' ' + DATENAME(d, astart) + ', '
                      + DATENAME(YYYY, astart) AS Date, DATENAME(hh, astart)
                      + ':' + DATENAME(mi, astart) AS "Time", fname + ' ' + lname AS Name,
                      location AS Place
FROM            Calendar l INNER JOIN Contacts n ON l.cid = n.cid
ORDER BY        astart;

Query result

Date               Time Name            Place
September 15, 2008 17:0 Joan Smith      NYIT, New York City
September 22, 2008 15:0 Sam Iam         Metropolitan Museum




                                                                             10/29/2008


                                                4

								
To top