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