SQL Create Table

www.igi‮editf‬a.com

To create a new table in an existing database in SQL, you can use the following syntax:

CREATE TABLE table_name (
  column1 datatype,
  column2 datatype,
  column3 datatype,
  ...
);

Replace table_name with the name you want to give your new table, and define the columns and data types that you want to include in the table.

For example, to create a simple table named customers with columns for id, name, and email, you can use the following SQL statement:

CREATE TABLE customers (
  id INT,
  name VARCHAR(50),
  email VARCHAR(50)
);

In this example, we've created a table called customers with three columns:

  • id with data type INT
  • name with data type VARCHAR(50) (which can hold up to 50 characters)
  • email with data type VARCHAR(50) (which can hold up to 50 characters)

You can add more columns and define their data types as needed. It's important to choose appropriate data types for your columns to ensure data integrity and efficient querying.