Изучаем sql


SELECT a.account_id, a.product_cd



Pdf көрінісі
бет247/261
Дата28.07.2022
өлшемі1,6 Mb.
#147825
1   ...   243   244   245   246   247   248   249   250   ...   261
Байланысты:
Изучаем SQL ( PDFDrive )

SELECT a.account_id, a.product_cd,
> i.fname, i.lname, b.name
> FROM account a LEFT OUTER JOIN business b
> ON a.cust_id = b.cust_id
> LEFT OUTER JOIN individual i
> ON a.cust_id = i.cust_id;
++++++
| account_id | product_cd | fname | lname | name |
++++++
| 1 | CHK | James | Hadley | NULL |
| 2 | SAV | James | Hadley | NULL |
| 3 | CD | James | Hadley | NULL |
| 4 | CHK | Susan | Tingley | NULL |
| 5 | SAV | Susan | Tingley | NULL |
| 6 | CHK | Frank | Tucker | NULL |
| 7 | MM | Frank | Tucker | NULL |
| 8 | CHK | John | Hayward | NULL |
| 9 | SAV | John | Hayward | NULL |
| 10 | MM | John | Hayward | NULL |
| 11 | CHK | Charles | Frasier | NULL |
| 12 | CHK | John | Spencer | NULL |
| 13 | CD | John | Spencer | NULL |
| 14 | CD | Margaret | Young | NULL |
| 15 | CHK | Louis | Blake | NULL |
| 16 | SAV | Louis | Blake | NULL |
| 17 | CHK | Richard | Farley | NULL |
| 18 | MM | Richard | Farley | NULL |
| 19 | CD | Richard | Farley | NULL |
| 20 | CHK | NULL | NULL | Chilton Engineering |
| 21 | BUS | NULL | NULL | Chilton Engineering |
| 22 | BUS | NULL | NULL | Northeast Cooling Inc. |


Решения к упражнениям
287
| 23 | CHK | NULL | NULL | Superior Auto Body |
| 24 | SBL | NULL | NULL | AAA Insurance Inc. |
++++++
24 rows in set (0.05 sec)
10.4 (дополнительно)
Разработайте запрос, который сформирует набор {1, 2, 3,…, 99, 100}.
(Совет: используйте перекрестное соединение как минимум с двумя
подзапросами в блоке 
from
.)
SELECT ones.x + tens.x + 1
FROM
(SELECT 0 x UNION ALL
SELECT 1 x UNION ALL
SELECT 2 x UNION ALL
SELECT 3 x UNION ALL
SELECT 4 x UNION ALL
SELECT 5 x UNION ALL
SELECT 6 x UNION ALL
SELECT 7 x UNION ALL
SELECT 8 x UNION ALL
SELECT 9 x) ones
CROSS JOIN
(SELECT 0 x UNION ALL
SELECT 10 x UNION ALL
SELECT 20 x UNION ALL
SELECT 30 x UNION ALL
SELECT 40 x UNION ALL
SELECT 50 x UNION ALL
SELECT 60 x UNION ALL
SELECT 70 x UNION ALL
SELECT 80 x UNION ALL
SELECT 90 x) tens;


Достарыңызбен бөлісу:
1   ...   243   244   245   246   247   248   249   250   ...   261




©engime.org 2024
әкімшілігінің қараңыз

    Басты бет