Home  >  Article  >  Database  >  sql语句之数据操作介绍

sql语句之数据操作介绍

WBOY
WBOYOriginal
2016-06-07 17:54:54933browse

表中数据的变化牵一发而动全身,会同时导致到索引中数据的变化。因此如果查询语句不需要索引,就应该删除无用的索引以提高效率。

一、insert语句

  insert用于向表中输入数据,其具体的语法结构如下。

   INSERT INTO 表名称 VALUES (值1, 值2,....)  我们也可以指定所要插入数据的列:

   INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....)   示例:
代码如下:
  insert into country values('美国')

二、update语句

  update语句用于更新表中的数据,其具体的语法结构如下。

   UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值   示例:
代码如下:
  update country set countryname = '中国' where countryid = 4

三、delete语句

  delete语句用于删除表中的数据,其具体的语法结构如下。

   DELETE FROM 表名称 WHERE 列名称 = 值  示例:
代码如下:
  delete from country where countryid = 4

Statement:
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