資料庫查詢語句
select * from 6130 where 編號列 = '61000014'
這個其實是個很簡單的查詢。
原理是這樣的
select * from 表名 where 編號列 = '61000014'
⑵ SQL 查詢語句
select 工作人員,年月,max(物品數量 )from 貨物 where 年月 between 2016-01 and 2016-01 and max(物品數量 )>500
⑶ sql查詢語句大全
SELECT * FROM TWS2F14CCC260D71 WHERE 地類='1999資源清查有林地'
⑷ 資料庫的查詢語句
SELECT
Movie.*
FROM
Movie, Player
WHERE
Movie.playactor = Player.playerID
AND Player.name LIKE '%nike%'
AND Player.sex = '男'
AND YEAR(GETDATE()) - YEAR(Player.birthday) > 40
上面是SQL Server 資料庫的寫法 下面是 Oracle 的
SELECT
Movie.*
FROM
Movie, Player
WHERE
Movie.playactor = Player.playerID
AND Player.name LIKE '%nike%'
AND Player.sex = '男'
AND (SYSDATE - Player.birthday) / 365 > 40
⑸ sql資料庫查詢語句
select gongsi as 單位,bumen as 部門,xingming as 姓名,xingbie as 性別,nianling as 年齡
from pxsgs
where gongsi='上海第二公司' and bumen='上瓷部' and xingming='李雷'
select gongsi as 單位,bumen as 部門,xingming as 姓名,xingbie as 性別,nianling as 年齡
from pxsgs
where gongsi='上海第二公司' and bumen='上瓷部' and xingming='張秋林'
⑹ SQL資料庫查詢語句
select * from aa t
where not EXISTS (select * from aa where 卡號=t.卡號 and 時間>t.時間)
---前提:相同卡號的最晚時間只有一個,沒有重復
⑺ sql 查詢語句
試一下這樣行不行,我這里沒有sql server2000的環境,呵呵
SELECT job_log.log_id, job_log.old_job, job_log.new_job, job_log.log_time, isnull(o_job.v_id,0) AS old_v, isnull(n_job.v_id,0) AS new_v
FROM job_log LEFT OUTER JOIN job o_job
ON (job_log.old_job = o_job.t_name)
LEFT OUTER JOIN job n_job
ON (job_log.new_job = n_job.t_name)
⑻ SQL的查詢語句怎麼寫
如果存在一張學生信息表,表名tStudent, 列名有學號NO,姓名Name,性別Sex等,你要查出姓名是張三的信息
select
*
from
tStudent
where
Name
=
'張三'
如果只想要表中幾列的信息,可以將*換成指定的列名,多列中間用逗號隔開,如:
select
NO,Name,Sex
from
tStudent
where
Name
=
'張三'
⑼ SQL查詢語句
1、說明:創建資料庫CREATE DATABASE database-name2、說明:刪除資料庫drop database dbname3、說明:備份sql server--- 創建 備份數據的 deviceUSE masterEXEC sp_admpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'--- 開始 備份BACKUP DATABASE pubs TO testBack4、說明:創建新表create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)
根據已有的表創建新表:
A:create table tab_new like tab_old (使用舊表創建新表)
B:create table tab_new as select col1,col2… from tab_old definition only5、說明:刪除新表drop table tabname6、說明:增加一個列Alter table tabname add column col type
註:列增加後將不能刪除。DB2中列加上後數據類型也不能改變,唯一能改變的是增加varchar類型的長度。7、說明:添加主鍵: Alter table tabname add primary key(col)
說明:刪除主鍵: Alter table tabname drop primary key(col)8、說明:創建索引:create [unique] index idxname on tabname(col….)
刪除索引:drop index idxname
註:索引是不可更改的,想更改必須刪除重新建。9、說明:創建視圖:create view viewname as select statement
刪除視圖:drop view viewname10、說明:幾個簡單的基本的sql語句
選擇:select * from table1 where 范圍
插入:insert into table1(field1,field2) values(value1,value2)
刪除:delete from table1 where 范圍
更新:update table1 set field1=value1 where 范圍
查找:select * from table1 where field1 like 』%value1%』 ---like的語法很精妙,查資料!排序:select * from table1 order by field1,field2 [desc]總數:select count as totalcount from table1
求和:select sum(field1) as sumvalue from table1
平均:select avg(field1) as avgvalue from table1
最大:select max(field1) as maxvalue from table1
最小:select min(field1) as minvalue from table1
⑽ sql簡單查詢語句
1、首先打開資料庫,建立好表。