Using SQL Server

(pictures coming tomorrow, 10-22, sorry for the delay) SQL Server, as we all know, is a database management system. However, that may not be enough information to let you get started on the assignment. So here's all the information you should need to get started.

Starting SQL Server

If you look at the SQL Server 7.0 menu on the start up list, you'll see that there are a number of different programs that you can run, including SQL Server Enterprise Manager, and Query Analyzer. Since at the moment none of your databases have any data in them, the first thing that you'll want to do is open up the enterprise manager and make sure that the server that we're using for the project is registered (meaning that SQL Server knows to look for where your database is stored). The machine that we'll be using is named ISQL01 (that's zero one at the end), so if you see that in the list, you don't need to worry about this next step.

Registering ISQLO1

To register ISQL01, right click on "SQL Server Group", and then choose "New SQL Sever Registration". This will bring up a wizard. The wizard will tell you what the wizard can accomplish... click next. At this point you should see something like this: Type in ISQL01 in the list of available servers, and click "add" so that you see it in the list of added servers. Click next again.

The next window will ask you what authentication you want to use; you want to connect using the first option, Windows NT authentication. Click next and add it to the existing SQL Server group, click next again. Then click finish; this should end the registration process.

Accessing your database

Now that we've ensured that ISQL01 is registered, you need to open your your database. Click on the little plus symbol next to ISQL01, which should expand the list. Click on the plus next to Databases, which will expand to show you all of the databases on the server (this could take a minute or two). The Console window should now look something like: Chose your database; it's probably your group name in all lowercase, but their may be some differences. You can check it on the Project groups page. So expand that by clicking on the plus symbol again (again, this may take a few minutes), and you'll see a list of things specific to your database including Diagrams, Tables, Views, etc. This is your database. :) Enjoy. Each group has 65 megs of space, so use it wisely. Keep in mind that you'll be using the database space for a few other homeworks as well, so don't go crazy importing the entire web.

Importing your assignment

To import the homework database, save it somewhere you can get at (which you can either get off the web page (but beware of using Netscape; it's buggy when accessing Access databases) or at \\rfilesrv2\students\rap\hw3.mdb), and then right click somewhere in your database info and choose "All Tasks"and then "import data" The wizard will tell you what this wizard can do, click next.

Next you choose a data source. This is the important part; make sure that for your source you have selected that you want an Microsoft Access source. Enter the filename, but don't worry about the username or password; leave them blank. The end should look something like:

Click next, and then follow the instructions to import all of the tables. You want to import all of the tables; don't try running a query to import the tables.

looking at the data

From the Enterprise Manager you can also see what the table's attributes are and what data is in the tables. Click on the "tables" and this will bring up the tables in the right panels. You'll notice that there are a number of tables there other than the ones that you've created; don't delete them, they're needed by SQL Server. To look at the data in a table, right click in a table, select "Open Table" and "Return All Rows."

To see what the attributes of a relation are, double click on the table.

Querying the database

Assuming that you have data in the database, you can now start querying. In the Console window, choose "Tools," "SQL Server Query Analyzer" It may ask you which database you want; type in ISQL01. Make sure that your group's database is the one showing in the DB window, (circled in red on the image) and use the green arrow (circled in green in the image) to run the query. The main window is where you enter your query.