I posted this code in my Sql and keep getting error (5: Unexpected token: DATABA
ID: 3861002 • Letter: I
Question
I posted this code in my Sql and keep getting error (5: Unexpected token: DATABASE in statement [create database])
create database mydatabase;
create table book(
iSBN_number int primary key,
title varchar2(20),
author varchar2(20),
cost varchar2(10)
)
insert into book values(1441438, 'Alice in Wonderland', 'Lewis Carroll' ,$7.95)
insert into book values(6006374,'A First Course in Database Systems (3rd ed.)','Jeffrey Ullman',$99.49)
insert into book values(3523323,'Database System Concepts','Abraham Silberschatz',$119.67)
create table bookCopy(
iSBN_number int primary key,
Sequence int ,
publicationDate Date
)
create table borrower
(
librarycard int autoincrement primery key,
name varchar2(20),
Address varchar2(20),
postalcode varchar2(20),
pnoneNumber varchar2(10),
Membershipdate date
)
create table librarian(
librarianId int auto primery key,
Name varchar2(20),
phone varchar2(10),
supervisor int
)
insert into librarian values(1,'Gertrude Smith','555-1212')
insert into librarian values(2,'Mable Markham','555-1212')
Explanation / Answer
Error I found:
Semicolons missing in all lines.
create database mydatabase;
use mydatabase;
create table book(
iSBN_number int primary key,
title varchar2(20),
author varchar2(20),
cost varchar2(10)
);
insert into book values(1441438, 'Alice in Wonderland', 'Lewis Carroll' ,$7.95);
insert into book values(6006374,'A First Course in Database Systems (3rd ed.)','Jeffrey Ullman',$99.49);
insert into book values(3523323,'Database System Concepts','Abraham Silberschatz',$119.67);
create table bookCopy(
iSBN_number int primary key,
Sequence int ,
publicationDate Date
);
create table borrower
(
librarycard int autoincrement primery key,
name varchar2(20),
Address varchar2(20),
postalcode varchar2(20),
pnoneNumber varchar2(10),
Membershipdate date
);
create table librarian(
librarianId int auto primery key,
Name varchar2(20),
phone varchar2(10),
supervisor int
);
insert into librarian values(1,'Gertrude Smith','555-1212');
insert into librarian values(2,'Mable Markham','555-1212');
I would advide you to execute the code please report, since am not getting a single error! :(
1. Open MySql will admin/super user permission
2. Execute 1 line (all lines terminates with semicolon) at a time and report where are you getting the error
3. You probably missed a line
use mydatabase;