基本的sql語法

2022-09-01 14:06:15 字數 1054 閱讀 3023

1. select: 用於從資料庫中選取資料

select name,value from table_name

2.select distinct 語句用於返回唯一不同的值(去重)

3.where 子句用於過濾記錄。

select

column_name,column_name

from

table_name

where column_name operator value;

從student表中查詢sid為'01'的學生名稱:

4.and & or 運算子用於基於乙個以上的條件對記錄進行過濾

and: 與條件,篩選出幾個條件同時滿足的記錄

or:或條件,篩選出幾個條件滿足其中乙個的記錄

5.order by : 公升序對記錄進行排序

6.update : 更新資料庫的值(注意:更新的是where語句的那個限定條件的值,如果沒有where則會更新全部的值)

7.delete:用於刪除行資料,工作中用得比較少。

delete

from

table_name

where some_column=some_value;

SQL基本語法

update 有關update,急!在oracle資料庫中 表 a id firstname,lastname 表 b id,lastname 表 a 中原來id,firstname兩個欄位的資料是完整的 表 b中原來id,lastname兩個欄位的資料是完整的 現在要把表 b中的lastname欄...

SQL基本語法

1.select列名稱 from 表名稱 2.selectdistinct 列名稱 from 表名稱 3.select列名稱 from 表名稱 where 列 運算子值 eg select frompersons where city beijing select from persons wher...

SQL基本語法

重要的ddl語句 create database 建立新資料庫 alter database 修改資料庫 create table 建立新錶 alter table 變更 改變 資料庫表 drop table 刪除表 create index 建立索引 搜尋鍵 drop index 刪除索引 1.s...