當前位置:首頁 » 編程語言 » 神器sqL代碼
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

神器sqL代碼

發布時間: 2022-06-07 11:17:14

A. 求sql代碼

1、select '工號','姓名','工作時間','工資','婚否' from table_name where '年齡'=40 and '性別'='女' and '婚否'='是' order by '工作時間';
2、select sum('個人工資')as '各部門工資總和','部門號','部門名' from table_name group by '部門名';
3、select name,'工號','工資','工資時間' from table_name where '工齡'=20 and '工資'<4000;

B. sql程序代碼

-----------Mx=10,y=10

ifnotexists(select1fromMwherex=10andy=10)
begin
insertintoM
select10asx,10asy,'A'ast

selectt
fromM
wherex=10andy=10
end
else
begin
---下面的這個賦值查詢必須是一行結果才可以
declare@Rltvarchar(10)
select@Rlt=t
fromM
wherex=10andy=10

if(@Rlt=Aor@Rlt=0)
begin
select@Rlt
end
if@Rlt=1
begin
selectt
fromA
wherex=10andy=10
end
if@Rlt=2
begin
selectt
fromB
wherex=10andy=10
end
if@Rlt=2
begin
selectt
fromB
wherex=10andy=10
end
if@Rlt=3
begin
selectt
fromC
wherex=10andy=10
end
end

C. SQL資料庫SQL命令操作代碼

USE 銷售管理
GO

CREATE PROCEDURE proc1
@商品名稱 nvarchar(50)
AS
SET NOCOUNT ON;
SELECT 商品名稱, 商品價格, 訂單編號,訂購數量,訂購日期
FROM 訂單信息
WHERE 商品名稱 = @商品名稱
GO

EXEC proc1 @商品名稱 = N'牙刷'
GO

D. 什麼是sql 代碼

sql代碼是用代碼操作資料庫,從資料庫里把數據取出來,加進去。

E. javascript裡面怎麼插入sql語句

沒搞錯吧!JS執行SQL?!!神器啊!雖說可以連接SQLserver,但是你也不考慮下你資料庫結構欄位這些被暴露??不怕別人注入?不怕別人攻擊?!!!用jquery ajaxsubmit吧!做後端程序寫入資料庫吧!不然你的應用不堪一擊!

F. 請教sql命令代碼

哦,你是要刪除表1中符合的,還是刪除表2中的符合記錄的呢?還是都刪除?
1,如果是只要選擇的話
select a.a1,a.a2,a.a3,a.a4,b.b4
from 表1 a,表2 b
where a.a1=b.b1 and a.a2=b.b2 and a.a3=b.b3
2,如果你要刪除表1符合要求的記錄
delete from 表1 where (a1,a2,a3) in (select a.a1,a.a2,a.a3 from 表1 a,表2 b where a.a1 = b.b1 and a.a2 = b.b2 and a.a3 = b.b3) c
3,如果你要刪除表2符合要求的記錄
delete from 表2 where (b1,b2,b3) in (select b.b1,b.b2,b.b3 from 表1 a,表2 b where a.a1 = b.b1 and a.a2 = b.b2 and a.a3 = b.b3) c
4,如果你都要刪除,那麼不能簡單的將2,3句子連起來寫,那樣不會成功,你需要一個中間媒介表來存儲信息。需要四句sql文:(#為中間表)
1) select a1,a2,a3 into # from
(select a1,a2,a3,a4,b4
from 表1 a,表2 b
where a.a1=b.b1 and a.a2=b.b2 and a.a3=b.b3) c
2)delete from 表1 where (a1,a2,a3) in (select a1,a2,a3 from #) c
3)delete from 表2 where (b1,b2,b3) in (select a1,a2,a3 from #) c
4) drop table #
我手上沒有裝SQL,語法可能有些錯誤,麻煩自己試一下。

G. 求一些常用的SQL代碼語句

select 欄位,欄位(或用*顯示全部欄位) from 表 where 條件 order by 欄位
where 條件 是可選的
order by 欄位 是可選的 排序用的
order by 欄位 desc 是倒序排列

舉例
select 表1.欄位,表2.欄位 from 表1,表2 where 表1.id=表2.id and(或or) 表1.id between '4' and '15' and 表2.姓名 like '%張%'
like用來做模糊搜索
where語句也可用於下面

update 表 set 欄位='15' where 條件

insert into 表1 (欄位,欄位……) select (欄位,欄位……) from 表2 where條件
insert into 表1 (欄位,欄位……) values (欄位,欄位……)

delete from 表 where 條件

H. SQL資料庫語言代碼

select top 10 * from student