博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
面试遇到的数据库考题
阅读量:2223 次
发布时间:2019-05-08

本文共 1739 字,大约阅读时间需要 5 分钟。

/*根据购买的金额,将用户信息进行排列*/

/*1.福州地区所有用户的销售额*/
/*2.建立存储过程,计算积分*/

 

 

insert into Customer values('001','zhangxq')

insert into Customer values('002','zhuangys')
insert into Customer values('003','zhuangys')

update Customer set names='zhangxq' where uid='002'

insert into Goods values('001','G01','25','100')

insert into Goods values('002','G02','35','130')
insert into Goods values('003','G03','25','100')
use Shopping
alter table Goods
alter column
goodsId varchar(51)

update Goods set uid='002' where goodsId='G02'

alter table Customer

add
address varchar(50)

update Customer set address='fz' where uid='001'

update Customer set address='xm' where uid='002'
update Customer set address='fz' where uid='003'

create table PromotionGood

(
goodsId varchar(51),
IsPromotion int check(Ispromotion=0 or IsPromotion=1)
)

insert into PromotionGood values('G01','0')

insert into PromotionGood values('G02','1')

/*根据购买的金额,将用户信息进行排列*/

/*1.福州地区所有用户的销售额*/
/*2.建立存储过程,计算积分*/

select *from Customer,Goods,PromotionGood

declare @amount bigint

set @amount = select sum(goodsAmount*goodPrice) from Goods where uid='001'
select *from Customer
select distinct c1.names from Customer c1,Customer c2 where c1.names<>c2.names

select *from Customer as c1 where c1.names in(select names from Customer as c2 where c1.names=c2.names)

select *from Customer as c1,Customer as c2  where c1.uid<>c2.uid and c1.uid in (select Goods.uid from  Goods,Customer where Goods.uid=Customer.uid and Customer.address='xm')

select *from goods

select sum(goodsAmount*goodPrice) from goods where goods.uid in( select Goods.uid from Customer,goods where Customer.uid=goods.uid and customer.address='fz')

 

一些比较常用的操作。。。。哎怎么会忘记呢。。。

转载于:https://www.cnblogs.com/xianqingzh/archive/2008/11/26/1341785.html

你可能感兴趣的文章
决策树的python实现
查看>>
Sklearn 快速入门
查看>>
了解 Sklearn 的数据集
查看>>
用ARIMA模型做需求预测
查看>>
推荐系统
查看>>
TensorFlow-11-策略网络
查看>>
浅谈 GBDT
查看>>
如何选择优化器 optimizer
查看>>
一文了解强化学习
查看>>
CART 分类与回归树
查看>>
seq2seq 的 keras 实现
查看>>
seq2seq 入门
查看>>
什么是 Dropout
查看>>
用 LSTM 做时间序列预测的一个小例子
查看>>
用 LSTM 来做一个分类小问题
查看>>
详解 LSTM
查看>>
按时间轴简述九大卷积神经网络
查看>>
详解循环神经网络(Recurrent Neural Network)
查看>>
为什么要用交叉验证
查看>>
用学习曲线 learning curve 来判别过拟合问题
查看>>