Tables used in SQL examples

s6a books

s6a Top

This table stores the data of the students in the class Secondary 6A, including class number (class_num), student identification code (stud_id), name (name), electronic mail address (email) and the examination marks of Chinese Language and Culture (clc), Use of English (ue), Physics (phy), Pure Mathematics (pm) and Computer Studies (cs).

Click here to download this table.

The SQL statement that creates this table

CREATE TABLE s6a
(class_num integer NOT NULL,
  stud_id char(5) NOT NULL,
  name char(30) NOT NULL,
  email char(30) NULL,
  clc integer NULL,
  ue integer NULL,
  phy integer NULL,
  pm integer NULL,
  cs integer NULL)

Contents of the table

class_num stud_id name email clc ue phy pm cs
1 92114 Chan Wai Man, Raymond s92114@sample.edu.hk 64 55 70 64 59
2 92133

Chow Chi Ling

clchow@example.com 70 62 62 59 70
3 94302 Fung Ching Man, Mandy mandyfung@example.com 72 50 42 59 60
4 91131 Hung Wai Ming s91131@sample.edu.hk 52 48 55 39 59
5 92153 Leung King kleung@example.com 40 50 51 40 60
6 92211 Poon Kwok Fai kwokfai@testing.com.hk 59 60 70 77 75
7 91194 Sung Hing Wah, Patrick patricksung@example.com 70 72 81 69 70
8 97602 Tang Wing Chi s97602@sample.edu.hk 80 79 70 72 69
9 92145 Wong Ka Tak, Kent klkwon@example.com 35 40 52 50 42
10 93211 Yeung Chun cyeung@testing.com.hk 69 80 77 60 52
11 96374 Lai Fung Chun s96374@sample.edu.hk 78 75 69 65 61
12 94412 Chan Lai Yin cly@testing.com.hk 43 59 53 61 60
13 98832 Man Fook Wing fwman@testing.com.hk 55 77 34 40 51
14 95343 Chung Kwok Fai, Fred fredchung@example.com 72 62 53 47 50
15 97233 Lee Lai May maylee@testing.com.hk 67 71 56 60 55

books Top

This table stores the data of the books in the library which are borrowed by the students, including the student identification number of the student who borrow the book (stud_id), the call number of the book (call_id) and the due date of return of the book (due_date).

Click here to download this table.

The SQL statement that creates this table

CREATE TABLE books
(stud_id char(5) NOT NULL,
  call_id char(6) NOT NULL,
  due_date date NOT NULL)

Contents of the table

stud_id call_id due_date
91131 804890 11/14/99
93211 821344 11/01/99
92114 871212 12/01/99
97602 887656 11/04/99
92133 845394 12/10/99
93211 845223 11/14/99
97233 834234 11/23/99
95343 864353 12/13/99
93211 824353 12/19/99
92211 882421 11/29/99
92133 812112 11/01/99
94302 844221 10/31/99
92211 853222 11/01/99
97602 862999 11/20/99
94302 811211 12/01/99
92145 844355 11/09/99
96374 899554 10/30/99
97233 811332 11/13/99
91194 845678 10/20/99
95343 866332 12/01/99
92145 888789 11/16/99
94302 876545 12/12/99
93211 904568 10/29/99
92153 899943 11/12/99
98832 877889 12/01/99
92114 804356 11/09/99
91194 881110 12/12/99
97602 891111 11/11/99
91194 894510 11/28/99
96374 879959 12/10/99
94412 811141 10/24/99