0

I tried to create table in mysql command line on ubuntu. This is code from book "Oracle Database 12c":

CREATE TABLE customers (
    customer_id INTEGER CONSTRAINT customers_pk PRIMARY KEY,
    first_name VARCHAR2(10) NOT NULL,
    last_name VARCHAR2(10) NOT NULL,
    dob DATE,
    phone VARCHAR2(12)
);

I got an error:

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 'CONSTRAINT customers_pk PRIMARY KEY,
    first_name VARCHAR2(10) NOT NULL,
    last_na' at line 2
2
  • 1
    MySQL and Oracle Server are two completely different database engines. If you want to work with MySQL, read MySQL books/resources. Commented Mar 1, 2017 at 21:13
  • @Mat - Better: If you want to read Oracle books/resources, install a free copy of Oracle Database! Commented Mar 1, 2017 at 21:15

2 Answers 2

1

I believe what you're trying to accomplish can be found below. You should be using data types that are supported by MySQL. Read more here.

CREATE TABLE customers
( 
  customer_id INTEGER NOT NULL,
  first_name VARCHAR(10) NOT NULL,
  last_name VARCHAR(10),
  dob DATE,
  phone VARCHAR(12),
  zip_code VARCHAR(10),
  CONSTRAINT customers_pk PRIMARY KEY (customer_id)
);
Sign up to request clarification or add additional context in comments.

2 Comments

Do you know any simple tutorial how to install oracle db 12c on ubuntu?
Try this. Your mileage may vary due to the ubuntu version, but it should be similar. You can also try 'install oracle db 12c on "ubuntu"' using Google search.
0

For Oracle 12c Installation in Ubuntu 16.04 refer Install Oracle 12c in Ubuntu 16.04 and to install Oracle 12c in Ubuntu 16.04.2 refer Install Oracle 12 in different versions of Ubuntu tested for Ubuntu 16.04.2

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.