SQL語句練習例項之七 剔除不需要的記錄行

2021-09-06 04:31:26 字數 455 閱讀 9473

--相信大家肯定經常會把資料匯入到資料庫中,但是可能會有些記錄行的所有列的資料是null,這為null的資料是我們不需要

--現在需要乙個簡單的查詢來剔除掉這些為null的記錄行。

--假設表名為 emplyees

--方法1.

---先把資料匯入到資料庫

---其次:

select * from sys.columns

where object_id =(select object_id from sys.objects where name='emplyees')

---方法2

---使用資料庫提供的函式

exec sp_columns 'employees'

delete from employees where coalesce(status,tel,gwei,address1,address2,nwei) is null

SQL語句練習

建立一張表,記錄 呼叫員的工作流水,記錄呼叫員編號,對方號碼,通話開始時間,結束時間。建表,插資料等都自己寫出sql 要求 輸出所有資料中通話時間最長的5條記錄。輸出所有資料中撥打長途號碼 對方號碼以0開頭 的總時長 輸出本月通話時長最多的前三個呼叫員的編號 輸出本月撥打 次數最多的前三個呼叫員的編...

SQL 語句練習

mysql select from persons limit 5 oracle select from persons where rownum 5 select from persons where name like l select from persons where name not l...

SQL語句練習

1 把兩張 的資料抽取出來放到另外一張 中 1 pt表 role id int pt int 2 season score表 role id int season score int 3 player表 role id int pt int season score int count int 4 ...