~/mysql >mysql --user=cs4010 --password=cs4010 --database=cs4010
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 MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 112
Server version: 5.5.41-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [cs4010]> show tables;
+------------------+
| Tables_in_cs4010 |
+------------------+
| athlete          |
| student          |
+------------------+
2 rows in set (0.00 sec)

MariaDB [cs4010]> drop table athlete;
Query OK, 0 rows affected (0.01 sec)

MariaDB [cs4010]> drop table student;
Query OK, 0 rows affected (0.01 sec)

MariaDB [cs4010]> source test0.sql
Query OK, 0 rows affected (0.01 sec)

MariaDB [cs4010]> show tables;
+------------------+
| Tables_in_cs4010 |
+------------------+
| student          |
+------------------+
1 row in set (0.00 sec)

MariaDB [cs4010]> insert into student (name,year,test) values ("Joe Jones","Senior",85);
Query OK, 1 row affected (0.00 sec)

MariaDB [cs4010]> insert into student (student_id,name,year,test) values (3,"Sam Smith","Junior",90);
Query OK, 1 row affected (0.00 sec)

MariaDB [cs4010]> show * student;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '* student' at line 1
MariaDB [cs4010]> select * from student;
+------------+-----------+--------+------+
| student_id | name      | year   | test |
+------------+-----------+--------+------+
|          1 | Joe Jones | Senior |   85 |
|          3 | Sam Smith | Junior |   90 |
+------------+-----------+--------+------+
2 rows in set (0.00 sec)

MariaDB [cs4010]> insert into student (name,year,test) values ("Bob Brown","Junior",75);
Query OK, 1 row affected (0.00 sec)

MariaDB [cs4010]> select * from student;
+------------+-----------+--------+------+
| student_id | name      | year   | test |
+------------+-----------+--------+------+
|          1 | Joe Jones | Senior |   85 |
|          3 | Sam Smith | Junior |   90 |
|          4 | Bob Brown | Junior |   75 |
+------------+-----------+--------+------+
3 rows in set (0.00 sec)

MariaDB [cs4010]> CREATE TABLE athlete
    -> (
    -> this_student int NOT NULL,
    -> Foreign KEY(this_student) REFERENCES student(student_id),
    -> sport varchar(255) NOT NULL
    -> );
Query OK, 0 rows affected (0.00 sec)

MariaDB [cs4010]> insert into athlete (this_student,sport) values (3,"Baseball");
Query OK, 1 row affected (0.00 sec)

MariaDB [cs4010]> select * from athlete;
+--------------+----------+
| this_student | sport    |
+--------------+----------+
|            3 | Baseball |
+--------------+----------+
1 row in set (0.00 sec)


MariaDB [cs4010]> insert into athlete (this_student,sport) values (7,"Baseball");
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`cs4010`.`athlete`, CONSTRAINT `athlete_ibfk_1` FOREIGN KEY (`this_student`) REFERENCES `student` (`student_id`))

MariaDB [cs4010]>  insert into student (student_id,name,year,test) values (3,"Joe  Smith","Junior",70);
ERROR 1062 (23000): Duplicate entry '3' for key 'PRIMARY'

MariaDB [cs4010]>  delete from student where student_id=3;
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`cs4010`.`athlete`, CONSTRAINT `athlete_ibfk_1` FOREIGN KEY (`this_student`) REFERENCES `student` (`student_id`))
MariaDB [cs4010]>