Previous Page
Next Page

1.4. Creating Tables Using the Load Script

A table is used to store data in a database, and, a database is typically composed of many tables.

After the Student_course database is opened or activated, you need to create tables in the Student_course database and insert data into the tables. To do this, run (execute) the load script, SQLServer2005_load.sql, that you downloaded and saved to your working directory.

Go to the directory where you saved the load script, SQLServer2005_load.sql. Double-click SQLServer2005_load.sql. Then, select the whole script and copy it. This script will be pasted into SQL Server's query editor. Open SQL Server's query editor as shown in Figure 1-12. Make sure that the Student_course database is active. Paste the load script into the query editor, as shown in the Figure 1-17.

Figure 1-17. Pasting the load script into the query editor


Once the script has been pasted into the query editor, execute this script by clicking the Execute button or the F5 shortcut key. This script takes only a few seconds to execute. You will get the results shown in Figure 1-18--on the bottom part of the screen under the Messages tab.

Figure 1-18. Executed load script


This script creates the tables Cap, Course, Department_to_major, Dependent, Grade_report, Plants, Prereq, Room, Section, Student, and teststu, in the Student_course database and inserts data into them. The tables in the Student_course database are laid out in Appendix A. We also present the T-SQL for the load script in Appendix B.

To view the tables that were created by the load script, expand the Student_course node and then expand the Tables node. You will get the screen shown in Figure 1-19. Every table shows up as a node under Student_course.


Previous Page
Next Page