SQL 基本語法 (筆記)

2021-09-23 18:31:44 字數 1331 閱讀 1487

用於訪問和運算元據庫

select:從資料庫中提取資料

select * from table_name where condition

select distinct * from table_name

select * from table_name order by * asc(desc)

update:更新資料庫資料

update table_name set column1 = value1, ... where condition

delete: 刪除資料庫資料

delete from table_name where condition

delete from table_name 刪除所有行而不刪除 表

insert into: 像資料庫插入資料

insert into table_name (column1,column2,...) values (value1,value2,...);

insert into table_name values (value1,value2,...)

create database:建立資料庫

create database  database_name

show databases 檢視所有資料庫

alter database:修改資料庫

create table:建立表

create table table_name (column1 data_type(size),...)

alter table:修改表

alter table table_name add column_name datatype

alter table table_name drop column column_name

alter table table_name alter column column_name datatype

drop table:刪除表

create index:增加索引

drop index:刪除索引

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...