You are on page 1of 7

Enter password: ******** Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 5 Server version: 5.5.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

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

mysql> use teacher Database changed mysql> create table supervision -> ( -> tecaher_id int unsigned not null, -> teacher_id int unsigned not null, -> student_id int unsigned not null, -> title varchar(50) -> , -> main_cosv char(4), -> primary key (teacher_id,student_id), -> foreign key (teacher_id) references teacher (teacher_id),

-> foreign key (student_id) references student (student_id), -> ); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 12 mysql> create table supervision -> ( -> teacher_id int unsigned not null, -> student_id int unsigned not null, -> title varchar(50), -> main_cosv char(4), -> primary key (teacher_id,student_id), -> foreign key (teacher_id) references teacher (teacher_id), -> foreign key (student_id) references student (student_id), -> ); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 10 mysql> create table supervision -> ( -> teacher_id int unsigned not null, -> student_id int unsigned not null, -> title varchar(50) -> main_cosv char(4), -> primary key (teacher_id,student_id),

-> foreign key (teacher_id) references teacher (teacher_id), -> foreign key (student_id) references student (student_id) -> ); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'main_ cosv char(4), primary key (teacher_id,student_id), foreign key (teacher_id)' at line 6 mysql> create table supervision -> ( -> teacher_id int unsigned not null, -> student_id int unsigned not null, -> title varchar(50), -> main_cosv char(4), -> primary key (teacher_id,student_id), -> foreign key (teacher_id) references teacher (teacher_id), -> foreign key (student_id) references student (student_id) -> ); ERROR 1005 (HY000): Can't create table 'teacher.supervision' (errno: 150) mysql> create table supervision -> (teacher_id int unsigned not null,student_id int unsigned not null,title varchar(50),main_cosv char(4),primary key(teacher_id,student_id),foreign key(tea cher_id) references teacher(teacher_id),foreign key(student_id) references stude nt(student_id)); ERROR 1005 (HY000): Can't create table 'teacher.supervision' (errno: 150)

mysql> use teacher Database changed mysql> create table supervision; ERROR 1113 (42000): A table must have at least 1 column mysql> create table supervision -> (teacher_id int unsigned not null,student_id int unsigned not null,title varchar(50),main_cosv char(4),primary key(teacher_id,student_id),foreign key(tea cher_id) references teacher(teacher_id),foreign key(student_id) references stude nt(student_id)); ERROR 1005 (HY000): Can't create table 'teacher.supervision' (errno: 150) mysql> show databases -> ; +--------------------+ | Database |

+--------------------+ | information_schema | | mysql |

| performance_schema | | perpustakaan | teacher | test | | |

+--------------------+ 6 rows in set (0.13 sec)

mysql> use teacher

Database changed mysql> create table supervision -> (teacher_id int unsigned not null,student_id int unsigned not null,title varchar(50),main_cosv char(4),primary key(teacher_id,student_id),foreign key(tea cher_id) references teacher(teacher_id),foreign key(student_id) references stude nt(student_id)); ERROR 1005 (HY000): Can't create table 'teacher.supervision' (errno: 150) mysql> create table supervision -> (teacher_id int unsigned not null); Query OK, 0 rows affected (0.05 sec)

mysql> alter table supervision add column student_id int unsigned not null,title varchar(50),main_cosv char(4)); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'title varchar(50),main_cosv char(4))' at line 1 mysql> alter table supervision add column student_id int unsigned not null; Query OK, 0 rows affected (0.11 sec) Records: 0 Duplicates: 0 Warnings: 0

mysql> alter table supervision add column title varchar(50),main_cosv char(4)); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'main_ cosv char(4))' at line 1 mysql> alter table supervision add column title varchar(50);

Query OK, 0 rows affected (0.02 sec) Records: 0 Duplicates: 0 Warnings: 0

mysql> alter table supervision add column main_cosv char(4); Query OK, 0 rows affected (0.09 sec) Records: 0 Duplicates: 0 Warnings: 0

mysql> alter table supervision add primary key(teacher_id,student_id); Query OK, 0 rows affected (0.40 sec) Records: 0 Duplicates: 0 Warnings: 0

mysql> alter table supervision add foreign key(teacher_id) referencess teacher(t eacher-id); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'refer encess teacher(teacher-id)' at line 1 mysql> alter table supervision add foreign key(teacher_id) referencess teacher(t eacher_id); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'refer encess teacher(teacher_id)' at line 1 mysql> alter table supervision add foreign key(teacher_id) referencess teacher ( teacher_id); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'refer

encess teacher (teacher_id)' at line 1 mysql> alter table supervision add foreign key(teacher_id) references teacher (t eacher_id); Query OK, 0 rows affected (0.13 sec) Records: 0 Duplicates: 0 Warnings: 0

mysql> alter table supervision add foreign key(student_id) references student (s tudent_id); ERROR 1005 (HY000): Can't create table 'teacher.#sql-7dc_5' (errno: 150) mysql> alter table supervision add foreign key(student_id) references student (s tudent_id); ERROR 1005 (HY000): Can't create table 'teacher.#sql-7dc_5' (errno: 150) mysql> alter table supervision add foreign key (student_id) references student ( student_id); ERROR 1005 (HY000): Can't create table 'teacher.#sql-7dc_5' (errno: 150) mysql>

You might also like