SQL
SQL
1. SET UP A DATABASE
mysql> CREATE DATABASE school;
Query OK, 1 row affected (0.03 sec)
2. OPEN DATABASE
mysql> USE school;
Database changed
4. Student
mysql> CREATE TABLE Students (
-> StudentID INT PRIMARY KEY,
-> Name VARCHAR(50),
-> Class INT,
-> Section CHAR(1),
-> Marks INT,
-> TeacherID INT,
-> Email VARCHAR(100),
-> FOREIGN KEY (TeacherID) REFERENCES Teachers(TeacherID));
Query OK, 0 rows affected (0.04 sec)
+-----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+-------+
| StudentID | int(11) | NO | PRI | NULL | |
| Name | varchar(50) | YES | | NULL | |
| Class | int(11) | YES | | NULL | |
| Section | char(1) | YES | | NULL | |
| Marks | int(11) | YES | | NULL | |
| TeacherID | int(11) | YES | MUL | NULL | |
| Email | varchar(100) | YES | | NULL | |
+-----------+--------------+------+-----+---------+-------+