Last login: Fri Mar 28 10:24:29 on ttyp1 Welcome to Darwin! web019059:~ perkins$ web019059:~ perkins$ ssh lab2-2.cs.mcgill.ca Password: Last login: Fri Mar 28 10:24:40 2008 from web019059.wireless.mcgill.ca The JVM for this session is: sun-jdk-1.6 The JVM for this session is: sun-jdk-1.6 [perkins][lab2-2][~] mysql mysql -h mysql.cs.mcgill.ca ERROR 1045 (28000): Access denied for user 'perkins'@'lab2-2.CS.McGill.CA' (using password: NO) [perkins][lab2-2][~] mysql mysql -h mysql.cs.mcgill.ca -p Enter password: ERROR 1044 (42000): Access denied for user 'perkins'@'%' to database 'mysql' [perkins][lab2-2][~] mysql -h mysql.cs.mcgill.ca -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 157389 Server version: 5.0.22 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show tables -> ; ERROR 1046 (3D000): No database selected mysql> quit Bye [perkins][lab2-2][~] mysql -h mysql.cs.mcgill.ca -p 2008Winter364perkins Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 157390 Server version: 5.0.22 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show tables -> ; +--------------------------------+ | Tables_in_2008Winter364perkins | +--------------------------------+ | Movies | | Presidents | +--------------------------------+ 2 rows in set (0.00 sec) mysql> quit Bye [perkins][lab2-2][~] clear [perkins][lab2-2][~] [perkins][lab2-2][~] mysql -h mysql.cs.mcgill.ca -p 2008Winter364perkins Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 157563 Server version: 5.0.22 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> SHOW TABLES; +--------------------------------+ | Tables_in_2008Winter364perkins | +--------------------------------+ | Movies | | Presidents | +--------------------------------+ 2 rows in set (0.00 sec) mysql> show tables; +--------------------------------+ | Tables_in_2008Winter364perkins | +--------------------------------+ | Movies | | Presidents | +--------------------------------+ 2 rows in set (0.01 sec) mysql> SELECT * FROM Movies; +---------------------+------------------------------+------+ | Name | Director | Year | +---------------------+------------------------------+------+ | Horton Hears a Who! | Jimmy Hayward, Steve Martino | 2008 | | Meet the Browns | Tyler Perry | 2008 | | Shutter | Masayuki Ochiai | 2008 | +---------------------+------------------------------+------+ 3 rows in set (0.00 sec) mysql> SELECT * FROM Presidents; +-----------+----------+-----------+---------+ | Firstname | Lastname | StartYear | EndYear | +-----------+----------+-----------+---------+ | Bill | Clinton | 1992 | 2000 | | George | Bush | 1988 | 1992 | | Ronald | Reagan | 1980 | 1988 | | George | Bush Jr. | 2000 | 2008 | | Who | Knows? | 2008 | NULL | +-----------+----------+-----------+---------+ 5 rows in set (0.00 sec) mysql> DESCRIBE Movies -> ; +----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+-------+ | Name | varchar(100) | YES | | NULL | | | Director | varchar(100) | YES | | NULL | | | Year | int(11) | YES | | NULL | | +----------+--------------+------+-----+---------+-------+ 3 rows in set (0.00 sec) mysql> CREATE TABLE Students ( -> Name varchar(100), -> ID varchar(100), -> Grade varchar(100), -> Aborted [perkins][lab2-2][~] mysql -h mysql.cs.mcgill.ca -p 2008Winter364perkins Enter password: ERROR 1045 (28000): Access denied for user 'perkins'@'lab2-2.CS.McGill.CA' (using password: YES) [perkins][lab2-2][~] mysql -h mysql.cs.mcgill.ca -p 2008Winter364perkins Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 157646 Server version: 5.0.22 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> CREATE TABLE Students ( -> Name varchar(100), -> ID int, -> Grade varchar(100), -> PercentGrade real -> ); Query OK, 0 rows affected (0.00 sec) mysql> DESCRIBE Students -> ; +--------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+--------------+------+-----+---------+-------+ | Name | varchar(100) | YES | | NULL | | | ID | int(11) | YES | | NULL | | | Grade | varchar(100) | YES | | NULL | | | PercentGrade | double | YES | | NULL | | +--------------+--------------+------+-----+---------+-------+ 4 rows in set (0.00 sec) mysql> SELECT * FROM Students -> ; Empty set (0.01 sec) mysql> INSERT INTO Students V mysql> INSERT INTO Students VALUES ('Bob',314,'A+',96.4); Query OK, 1 row affected (0.00 sec) mysql> SELECT * FROM Students -> ; +------+------+-------+--------------+ | Name | ID | Grade | PercentGrade | +------+------+-------+--------------+ | Bob | 314 | A+ | 96.4 | +------+------+-------+--------------+ 1 row in set (0.00 sec) mysql> INSERT INTO Students VALUES ('Mary',110,'B',75.7); Query OK, 1 row affected (0.00 sec) mysql> SELECT * FROM Students; +------+------+-------+--------------+ | Name | ID | Grade | PercentGrade | +------+------+-------+--------------+ | Bob | 314 | A+ | 96.4 | | Mary | 110 | B | 75.7 | +------+------+-------+--------------+ 2 rows in set (0.00 sec) mysql> INSERT INTO Students VALUES ('Frank',253,'C',67), ('George',876,'B-',73.1); Query OK, 2 rows affected (0.00 sec) Records: 2 Duplicates: 0 Warnings: 0 mysql> SELECT * FROM Students;+--------+------+-------+--------------+ | Name | ID | Grade | PercentGrade | +--------+------+-------+--------------+ | Bob | 314 | A+ | 96.4 | | Mary | 110 | B | 75.7 | | Frank | 253 | C | 67 | | George | 876 | B- | 73.1 | +--------+------+-------+--------------+ 4 rows in set (0.00 sec) mysql> INSERT INTO Students (Name,ID) VALUES ('Veronique',129); Query OK, 1 row affected (0.00 sec) mysql> SELECT * FROM Students; +-----------+------+-------+--------------+ | Name | ID | Grade | PercentGrade | +-----------+------+-------+--------------+ | Bob | 314 | A+ | 96.4 | | Mary | 110 | B | 75.7 | | Frank | 253 | C | 67 | | George | 876 | B- | 73.1 | | Veronique | 129 | NULL | NULL | +-----------+------+-------+--------------+ 5 rows in set (0.00 sec) mysql> SELECT Name FROM Students; +-----------+ | Name | +-----------+ | Bob | | Mary | | Frank | | George | | Veronique | +-----------+ 5 rows in set (0.00 sec) mysql> SELECT ID, Grade FROM Students; +------+-------+ | ID | Grade | +------+-------+ | 314 | A+ | | 110 | B | | 253 | C | | 876 | B- | | 129 | NULL | +------+-------+ 5 rows in set (0.00 sec) mysql> SELECT * FROM Students -> ; +-----------+------+-------+--------------+ | Name | ID | Grade | PercentGrade | +-----------+------+-------+--------------+ | Bob | 314 | A+ | 96.4 | | Mary | 110 | B | 75.7 | | Frank | 253 | C | 67 | | George | 876 | B- | 73.1 | | Veronique | 129 | NULL | NULL | +-----------+------+-------+--------------+ 5 rows in set (0.00 sec) mysql> SELECT * FROM Students WHERE PercentGrade >= 70; +--------+------+-------+--------------+ | Name | ID | Grade | PercentGrade | +--------+------+-------+--------------+ | Bob | 314 | A+ | 96.4 | | Mary | 110 | B | 75.7 | | George | 876 | B- | 73.1 | +--------+------+-------+--------------+ 3 rows in set (0.00 sec) mysql> SELECT * FROM Students WHERE Grade < 'C'; +--------+------+-------+--------------+ | Name | ID | Grade | PercentGrade | +--------+------+-------+--------------+ | Bob | 314 | A+ | 96.4 | | Mary | 110 | B | 75.7 | | George | 876 | B- | 73.1 | +--------+------+-------+--------------+ 3 rows in set (0.00 sec) mysql> SELECT * FROM Students; +-----------+------+-------+--------------+ | Name | ID | Grade | PercentGrade | +-----------+------+-------+--------------+ | Bob | 314 | A+ | 96.4 | | Mary | 110 | B | 75.7 | | Frank | 253 | C | 67 | | George | 876 | B- | 73.1 | | Veronique | 129 | NULL | NULL | +-----------+------+-------+--------------+ 5 rows in set (0.00 sec) mysql>