增刪改查 T SQL最基本操作

2022-05-24 03:54:06 字數 607 閱讀 2972

use test --操作test表

go--查詢

select * from stu -- 查詢stu裡的所有資料

select top 3 * from stu -- 查詢stu裡前三行資料

select top 3 * from stu where age = 45 --查詢stu裡指定條件的前三行資料

go--插入資料

insert into stu values(11,'dsd',34,'male')--插入單行資料

insert stu --插入多行資料

select 12,'dsf',45,'female' union

select 8,'dsf',45,'female' union

select 13,'dsf',45,'female' --最後一組不用加union

go--刪除資料

truncate table stu--刪除表的所有資料

delete from stu where id = '7'--刪除滿足條件資料

--修改資料

update stu set name = 'hhhhh' where id = 6--修改指定條件資料

php最基本的增刪改查

請選擇暱稱 header content type text html charset utf 8 接收表單值 empty post names names names post names empty post text text text post text 連線資料庫 選擇資料庫 寫sql語句...

增刪改查基本操作

增加 建立資料庫 create database database name 建立資料庫中的表單 create table table name 列1 資料型別,列2 資料型別,列3 資料型別 往表單中新增資料 insert into table name values 1 2 3 刪除 刪除資料庫...

mongodb增刪改查基本操作

mongodb資料庫基本用法 查詢 1.條件操作符的使用,日期格式的查詢,長度 db.getcollection interougeproduct find interougestockmaps 2.查詢列只顯示指定字段 1 表示展示,0表示隱藏 db.getcollection interouge...