0

I am creating table in MySql by using the coomand, create table person ( id int, name int). Actually, I want to create table person if there exists no person table in database. Can anybody help me, how to acive this ?

2

4 Answers 4

4

How about CREATE TABLE IF NOT EXISTS person (id INT, name INT)?

Sign up to request clarification or add additional context in comments.

Comments

2

The manual page says that you should use

CREATE TABLE IF NOT EXISTS person (id int, name int);

Comments

2
CREATE TABLE IF NOT EXISTS person (id int, ...);

See manual.

Comments

1

Use IF NOT EXISTS:

create table if not exists person ( id int, name int).

See MySQL documentation

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.