Home > Database > Mysql Tutorial > body text

sql creates tables, modifies table structures, and deletes tables

伊谢尔伦
Release: 2016-12-03 10:49:00
Original
1590 people have browsed it

1. Create a database table

--Which database to use, if you don’t write this sentence, it is the default database, you can also use the mouse to select the current database

use testDB

--Create table

Create Table tablename

(

                                                                                                                                                                                           .

id int primary key not null identity(1,1),

--unique name varchar(20) not null unique

)

2. Delete table

Drop table table name

3. Modify the table structure

--Add column

Alter table table name

Add column name type

--Delete column

Alter table table name

drop cloumn column name

--Modify column, modify column Type

Alter table table name

Alter column column name type

Related labels:
sql
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!