如何在mysql查询中执行此操作? [英] how to do this in mysql query?

查看:78
本文介绍了如何在mysql查询中执行此操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1。
考虑一个书店的分布式数据库,有4个站点,分别是S1,S2,S3和S4。

考虑以下关系:

书籍(ISBN,主要

作者,主题,总计

库存,价格)

预订

商店

(商店否

,城市,州,邮编,发明

toryValue)

库存

(商店否

,ISBN,数量)

T

总额

库存是库存和库存中的书籍总数

价值是商店的总库存价值(美元)。

考虑到书籍按价格分割成:

F1:书籍:价格高达20美元

F2:

书籍:价格从20.01美元到50美元

F3:书籍:价格从$ 50.01至$ 100

F4:书籍:价格100.01美元及以上

同样,预订

商店按邮政编码分为:

16

S1:书店:拉链高达25000

S2:Bookstor e:邮编25001到50000

S3:书店:邮编50001到75000

S4:书店:邮编75001到99999

任务:编写SQL查询以下

1.

在每张表中插入和显示详细信息。

2.

查找库存总数在15美元到55美元之间。

3.

更新

书价

$

预订否

= 1234从现在的45美元到55美元

S3。

4. br />
查找网站S2上的图书总数。

1. Consider a distributed database for a bookstore with 4 sites called S1, S2, S3 and S4.
Consider the following relations:
Books ( ISBN, primary
Author, topic, total
Stock, price )
Book
Store
(store No
, city, state, zip, inven
toryValue )
Stock
(store No
, ISBN, Qty )
T
otal
Stock is the total number of books in stock and inventory
Value is the total
inventory value for the store in dollars.
Consider that Books are fragmented by price amounts into:
F1: Books: price up to $20
F2:
Books: price from $20.01 to $50
F3: Books: price from $50.01 to $100
F4: Books: price $100.01 and above
Similarly, Book
Stores are divided by ZIP codes into:
16
S1: Bookstore: Zip up to 25000
S2: Bookstore: Zip 25001 to 50000
S3: Bookstore: Zip 50001 to 75000
S4: Bookstore: Zip 75001 to 99999
Task: Write SQL query for the following
1.
Insert and Display details in each table.
2.
Find the total number of books in stock where price is between $15 and $55.
3.
Update the
book price
of
book No
=1234 from $45 to $55 at site
S3.
4.
Find total number of book at site S2.

推荐答案

20

F2:

书籍:价格从
20
F2:
Books: price from


20.01到


50

F3:书籍:价格来自
50
F3: Books: price from


这篇关于如何在mysql查询中执行此操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆