Home Database Mysql Tutorial sql alert 修改表或增加列

sql alert 修改表或增加列

Jun 07, 2016 pm 05:46 PM
alter drop name table

sql 的alert命令是用来修改数据表名,增加列,删除列,修改字段数据类型等.好了下面我们来一个个看实例吧.

数据库ALTER TABLE语法
要添加一列在一个表中,使用下列语法:

ALTER TABLE table_name  ADD column_name datatype
Copy after login
来看个增加例的实例:
Copy after login
<pre class="brush:php;toolbar:false">ALTER TABLE tname  ALTER COLUMN data year
Copy after login
 
Copy after login
这样给tname表加上了一个列为data 类型的year字段
Copy after login
上面是在表中加列的语法下面我们再来看看删除列吧 DROP COLUMN column_name
Copy after login
ALTER TABLE table_name DROP COLUMN column_name
Copy after login
来看个<strong>删除列</strong>实例.
Copy after login
<pre class="brush:php;toolbar:false">ALTER TABLE Persons DROP COLUMN DateOfBirth
Copy after login
再来修改字段类型:
Copy after login
 ALTER COLUMN column_name datatype _id order by w_support desc
Copy after login
P_Id  LastName   FirstName  Address City <br>1       Hansen      Ola        Timoteivn 10 Sandnes <br>2       Svendson    Tove       Borgvn 23 Sandnes <br>3      Pettersen     Kari      Storgt 20 Stavanger
Copy after login
本站整理转载请注明:   
Copy after login
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement drag-and-drop sorting and drag-and-drop operations in uniapp How to implement drag-and-drop sorting and drag-and-drop operations in uniapp Oct 19, 2023 am 09:39 AM

Uniapp is a cross-platform development framework. Its powerful cross-end capabilities allow developers to develop various applications quickly and easily. It is also very simple to implement drag-and-drop sorting and drag-and-drop operations in Uniapp, and it can support drag-and-drop operations of a variety of components and elements. This article will introduce how to use Uniapp to implement drag-and-drop sorting and drag-and-drop operations, and provide specific code examples. The drag-and-drop sorting function is very common in many applications. For example, it can be used to implement drag-and-drop sorting of lists, drag-and-drop sorting of icons, etc. Below we list

Can't drop database 'database_name'; database doesn't exist - How to solve MySQL error: Can't drop database, database doesn't exist Can't drop database 'database_name'; database doesn't exist - How to solve MySQL error: Can't drop database, database doesn't exist Oct 05, 2023 am 11:46 AM

How to solve MySQL error: Unable to delete database, database does not exist Overview: MySQL is a commonly used relational database management system. When using MySQL, we often need to manage the database, including creating databases, deleting databases and other operations. However, when deleting a database, sometimes you will encounter the error message "Can'tdropdatabase'database_name';databasedoesn'texist", that is, you cannot delete it.

Deal | Tesla Model 3 Long Range AWD regains full $7,500 tax incentive, drops to below $40,000 Deal | Tesla Model 3 Long Range AWD regains full $7,500 tax incentive, drops to below $40,000 Jun 19, 2024 am 09:55 AM

Shortly after Tesla launched the Model 3 Highland refresh towards the end of last year, the US federal EV tax incentive rules changed, cutting the potential discount in half for eligible buyers because of Tesla's use of Chinese LFP cells in the new M

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

How to add name to setup in Vue3 How to add name to setup in Vue3 May 13, 2023 am 09:40 AM

What is the use of name in Vue3? 1. Name needs to be defined when making recursive components. 2. The component can be cached with keep-aliveincludeexclude. 3. When Vue reports an error or is debugging, you can see the name of the component. Vue3 defines name1. It is automatically generated as long as the setup syntax sugar mode single file component is turned on in the script. The corresponding name option will be automatically generated based on the file name. For example, Tree.vue, then its name will be automatically generated by Tree. This has a drawback. If you want to modify the name, you need to modify the component name. If there is a place to import the component, you need to modify it together. 2. Open a script to define name

The purpose of SQL ALTER statement The purpose of SQL ALTER statement Feb 19, 2024 pm 05:01 PM

The function of the SQL ALTER statement requires specific code examples. In a database management system, the ALTER statement is a SQL command used to modify database objects. Through the ALTER statement, we can modify database objects such as tables, columns, indexes, and views, including adding, deleting, modifying, and other operations. The following will introduce the common usage of the ALTER statement in detail and provide relevant code examples. ALTERTABLE statement is used to modify the structure of the table. You can add, delete, modify columns, constraints, indexes, etc.

What are the differences between drop and delete? What are the differences between drop and delete? Dec 29, 2023 am 10:09 AM

The difference between drop and delete: 1. Function and purpose; 2. Operation object; 3. Reversibility; 4. Space release; 5. Execution speed and efficiency; 6. Interaction with other commands; 7. Persistence of influence; 8 , syntax and execution; 9. Triggers and constraints; 10. Transaction processing. Detailed introduction: 1. Function and purpose. "DELETE" is a data operation language command, mainly used to delete some or all tuples from a table, that is, delete data content. "DROP" is a data definition language command, used to delete data from a table. Delete one from the database and so on.

How to use vue3 table component How to use vue3 table component May 12, 2023 pm 09:40 PM

Basic table Before developing the table component, first think about what style of API to use. Because the author uses element in production work, the styles of the previous components are similar to element, but this time I do not plan to use the element style. , I plan to change it and display it directly: We expect users to use it like this: constdataList=[{id:1,name:'"JavaEE Enterprise Application Practice"',author:'dev1ce',price:'10.22',desc:&# 3

See all articles