L
L
LionG2018-12-25 15:51:42
SQL
LionG, 2018-12-25 15:51:42

What is the correct way to write an IF condition to create a table and add its indexes if it doesn't already exist?

It is necessary to check for the existence of the table and if the table does not exist, then create it and add several indexes. A simple problem, but I constantly catch some errors and have no idea how to solve them. Of course, you can do everything through PHP with separate queries, but I would like 1 SQL query.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2018-12-25
@LionG

CREATE TABLE IF NOT EXISTS ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question