create table
时间: 2023-09-12 12:06:09 浏览: 72
createtable.sql
To create a table in a database, you can use the following SQL syntax:
```
CREATE TABLE table_name (
column1 datatype constraints,
column2 datatype constraints,
column3 datatype constraints,
...
);
```
Here's an example:
```
CREATE TABLE customers (
id INT PRIMARY KEY,
name VARCHAR(50),
email VARCHAR(50),
age INT
);
```
This creates a table called `customers` with four columns: `id`, `name`, `email`, and `age`. The `id` column is set as the primary key. The `name` and `email` columns are of type `VARCHAR` and have a maximum length of 50 characters. The `age` column is an integer.
阅读全文