How to use the SQL CREATE TABLE statement

jacklove
Release: 2023-03-25 15:36:01
Original
2421 people have browsed it

The

SQL CREATE TABLE statement is very important in php, and this article will explain it in detail.

CREATE TABLE statement

The CREATE TABLE statement is used tocreate a table in the database.

SQL CREATE TABLE syntax

CREATE TABLE table name
(
Column name 1 Data type,
Column name 2 data type,
Column name 3 data type,
....
)

SQL CREATE TABLE example

This example demonstrates how to create a table named "Person".

The table contains 5 columns, the column names are: "Id_P", "LastName", "FirstName", "Address" and "City":

CREATE TABLE Persons
(
Id_P int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
Copy after login

Data type of the Id_P column Is an int, containing integer. The data type of the remaining 4 columns is varchar, with a maximum length of 255 characters.

This article explains the relevant knowledge. For more learning materials, please pay attention to the php Chinese website to view.

Related recommendations:

Understand the relevant knowledge of SQL INNER JOIN keyword

Related knowledge about SQL JOIN

Explanation on SQL Alias ​​(alias) in php

The above is the detailed content of How to use the SQL CREATE TABLE statement. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template