50 likes | 65 Views
SQL HW1. Turn in as a hardcopy at the start of next class period. You may work this assignment in groups. Using MySQL. The MySQL server is on candler.cs.unca.edu ssh to candler before connecting to the MySQL server Logon to the server using the student account as follows:
E N D
SQL HW1 Turn in as a hardcopy at the start of next class period. You may work this assignment in groups.
Using MySQL • The MySQL server is on candler.cs.unca.edu • ssh to candler before connecting to the MySQL server • Logon to the server using the student account as follows: candler> mysql –u student This account does not have a password • Use the orderEntry database for this HW: mysql> use orderEntry; • To run a query that has been stored in a file with the name query1.sql (in the current working directory): mysql> source query1.sql;
OPTIONAL: Connecting to the MySQL Server from OpenOffice Base on Windows • Download the ‘Driver Installer (zipped EXE)’ for Windows from: http://dev.mysql.com/downloads/connector/odbc/3.51.html • Follow the ‘Configuring a MyODBC DSN on Windows’ instructions on: http://dev.mysql.com/doc/refman/5.0/en/myodbc-configuration-dsn-windows.html • In Base select connect to an ‘existing database’ and follow instructions.
Some basic SQL statements: • Show the databases that are available for you to query: mysql> show databases; • Select a database with the use command: mysql> use <dataBaseName>; • Show the tables in a database: mysql> show tables; • After executing the use <dataBaseName> command • View the attributes of a table: mysql> describe <tableName>; • After executing the use <dataBaseName> command
Formulate the following queries in SQL and turn in a hardcopy of each query: • Develop queries to answer the following questions from page 125 of your textbook: 2, 5, 6, 13