SQL語句常用操作

2021-08-22 13:26:13 字數 287 閱讀 6872

一切的一切,都是源於對知識的渴望……

最近有用到postgre這個資料庫,但是以前聽都沒有聽過,不斷的向別人請教,總算是現在能暫時操作這個資料庫了,之前有學過sql語句,但是不用了之後就感覺已經忘得差不多了,所以趕緊多看了些資料,在w3school上又重新學了下,溫故而知新啊!

下面我就記錄下,我常用的一些命令吧,sql語句的語法在資料庫方面都是相通的,都可以使用:

清空表中資料:

truncate table 表名  和 delete from 表名 兩個最終效果是一樣的,它們各自的特點我也標紅了

常用SQL操作語句筆記

新建表 create table 表名 自動編號字段 int identity 1,1 primary key 欄位1 nvarchar 50 default 預設值 null 欄位2 ntext null 欄位3 datetime,欄位4 money null 欄位5 int default 0,...

MySQL 常用sql操作語句

獲取資料庫裡所有表 select table name,table rows from information schema.tables where table schema 資料庫名 獲取表裡所有字段 select column name from information schema.colu...

MySQL 常用sql操作語句

獲取資料庫裡所有表 select table name,table rows from information schema.tables where table schema 資料庫名 獲取表裡所有字段 select column name from information schema.colu...