1. 程式人生 > >SQL Server 資料庫增刪改查語句

SQL Server 資料庫增刪改查語句

在使用SQL Server的時候,需要在新建查詢中簡單的處理資料庫,下面介紹一下SQL基礎的增刪改查語句:

介紹下面用到的變數:

Table:資料庫表名

Column::欄位

Content:內容

1、SQL查詢語句

查詢全表:select * from Table  

根據欄位條件查詢:select * from Table whereColumn = '條件'

根據同時滿足多個欄位條件查詢:select * from Table whereColumn = '條件' andColumn = '條件' and ...

根據多個欄位中的條件查詢:select * from Table whereColumn

= '條件' or Column = '條件' or ...

查詢表中某個欄位:select ColumnColumn,... from Table 

2、SQL新增語句

insert into Table (Column,Column,...) values ('Content','Content',...)

3、SQL刪除語句

根據欄位中的條件刪除行:delete from Table where Column = '條件'

根據多個欄位中的條件刪除:delete from Table where Column = '條件'' andColumn = '條件' and ...

根據同時滿足多個欄位中的條件刪除:delete from Table where Column = '條件' orColumn = '條件' or ...

根據同個欄位中不同條件刪除多行:delete from Table where Column in (條件,條件,...)

4、SQL修改語句

修改全表字段內容:update Table set Column = 'Content' , Column = 'Content' , ...

根據欄位條件修改該行的欄位內容:

update Table set Column = 'Content' ,Column = 'Content' , ...where Column = '條件'

根據同時滿足多個欄位條件修改欄位內容:

update Table set Column = 'Content' ,Column = 'Content' , ...where Column = '條件' and Column = '條件' and ...

根據多個欄位條件修改欄位內容:

update Table set Column = 'Content' ,Column = 'Content' , ...where Column = '條件' orColumn = '條件' or ...

OK,這就是基礎的SQL增刪改查。

相關推薦

SQL Server 資料庫刪改語句

在使用SQL Server的時候,需要在新建查詢中簡單的處理資料庫,下面介紹一下SQL基礎的增刪改查語句: 介紹下面用到的變數: Table:資料庫表名 Column::欄位 Content:內容 1

SQL Server資料庫————刪改

--增刪改查--增 insert into 表名(列名) value(值列表) --刪 delect from 表名 where 條件 --改 update 表名 set 列名=值1,列名2=值2 where 條件 --查 select 列名1,列名2,...from 表名 where 條件 gr

SQL server :“刪改” 之 “改”

image 表名 語法 多列 ring 意思 就會 單擊 行修改 1.前言 2.通過SSMS修改數據 3.通過SQL語句修改數據 3.1 修改單列數據 3.2 修改多列數據 1.前言 增刪改查都是對數據的操作,其中“改”對應的SQL語句便是“update”,也就是“更新

SQL server :“刪改” 之 “

keyword 文件 ase ins gui lte dep 依次 下載 1.前言 2.通過SSMS添加數據 3.通過SQL語句添加數據 3.1 添加單條數據 3.2 添加多條數據 4.通過其他表導入數據 4.1 通過數據庫中的其他表導入數據 4.2 通過excel表

C# 操作本地SQL Server實現刪改

VS2015 連線本地SQL Server  using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks

Qt/C++ 資料庫SQL 刪改 語句示例

注:文中例子均使用QSQLITE 一,增 QSqlQuery query;query.prepare(QString("INSERT INTO playList%1(songname,songurl

C#連線資料庫刪改程式碼 SQL SERVER/ACCESS 通用類

using System.Data.OleDb; using System.Data; public static class DataTools { private static OleDbConnection oleCo

SQL常用刪改語句

滿足 between 結構 模糊 運算 源表 刪除表 sel 模糊查詢 1增 1.1【插入單行】insert [into] <表名> (列名) values (列值)例:insert into Strdents (姓名,性別,出生日期) values (‘開心朋

複習之SQL語句(一)——常用單表“刪改語句使用

結構化查詢語言(Structured Query Language)簡稱SQL 結構化查詢語言是高階的非過程化程式語言,允許使用者在高層資料結構上工作。它不要求使用者指定對資料的存放方法,也不需要使用者瞭解具體的資料存放方式,所以具有完全不同底層結構的不同資料庫

sql 基礎刪改語句

1.1【插入單行】insert [into] <表名> (列名) values (列值)例:insert into Strdents (姓名,性別,出生日期) values ('開心朋朋','男',

MYSQL資料庫 刪改基礎語句

語法:create table tablename(column_name_1 column_type_1 constraints,column_name_2 column_type_2 constraints,column_name_3 column_type_3 constraints)

php操作mysql資料庫的連線語句以及最簡單的刪改語句

//-------------------------------------------------------------------------- //-----------------------查詢剛剛插入的資料------------------------ $con = mysql_connec

資料庫刪改的四個單表語句

一、對資料的處理插入:insert into 表名(列明,列明,...)  values(?,?,...);刪除:delete from 表名 【where 條件】;更新:update 表名 set 列名=值,列名=值,...【where 列名=值】查詢:select 【列名

C#Winfrom資料庫刪改例項--SQL操作版

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq;

資料庫的基本SQL操作(刪改

1、為表新增主鍵 alter table <tablename> add primary key(col); 主鍵新增前: 主鍵新增後: 2、插入資料 insert into <tablename> (field1,fi

Flask框架教程彙總(5)---其中有原生sql +資料庫刪改+ migrate遷移 等

本節目錄: 1 原生sql資料庫 2 在flask中使用ORM模型 3 設計表模型 4 建立模型 5 資料的增/刪/改操作 6 拆分成mvt 7 自定義刪除的類 8 資料的查詢操作 9 資料的邏輯查詢 10

mysql數據庫的刪改語句

mss 成功 -h 突出 返回 name 存在 從大到小 修改用戶密碼 連接命令:mysql -h[主機地址] -u[用戶名] -p[用戶密碼] 創建數據庫:create database [庫名] 顯示所有數據庫: show databases; 打開數據庫:

關於MySQL數據庫——刪改語句集錦

讀取 產品分析 ati 內容 tinc set pan 取出 模糊查詢 一、基本的sql語句 CRUD操作:create 創建(添加)read 讀取update 修改delete 刪除1、添加數據insert into Info values(‘p009‘,‘張三‘,1,‘

SQL Server刪改操作

values 數據表 所有 var rop varchar con foreign entity -------添加約束、增刪改 1 use StudentDB2 2 go 3 --------創建學生表--------- 4 create table Stud

SQL語言的刪改

刪除 bob show into lec eat reat 註入 ike select(查), update(改), delete(刪), insert into(增) select * from table_name 獲取表中所有字段 select id, name,