|
Программирование >> Хронологические базы данных
7.14. Мы перенумеровали решения для этого пункта в виде 7.14./?, где п- номер исходного упражнения в главе 6, т.е. упр. в.п. Относительно определения и именования переменных доменов будем следовать соглашениям, принятым в разделе 7.6. 7.14.13. ( JX, NAMEX, CITYX ) WHERE J { J#:JX, JNAME:NAMEX, CITY:CITYX ) 7.14.14. { JX, NAMEX, London AS CITY ) WHERE J ( J#:JX, JNAME:NAMEX, CITY:London ) 7.14.15.SX WHERE SPJ ( S#:SX, J#:J# ( Jl ) ) 7.14.16. ( SX, PX, JX, QTYX ) WHERE SPJ ( S#:SX, P#:PX, Ji:JX, QTY:QTYX ) AND QTYX > QTY ( 300 ) AND QTYX < QTY { 750 ) 7.14.17. { COLORX, CITYX WHERE P { COLOR:COLORX, CITY:CITYX ) ) 7.14.18. ( SX, PX, JX ) WHERE EXISTS CITYX ( S ( S#:SX, CITY:CITYX ) AND P ( P#:PX, CITY:CITYX ) AND J ( J#:JX, CITY:CITYX ) ) 7.14.19. ( SX, PX, JX ) WHERE EXISTS CITYX EXISTS CITYY EXISTS CITYZ ( S ( S#:SX, CITY:CITYX ) AND P ( P#:PX, CITY:CITYY ) AND J ( J#:JX, CITY:CITYZ ) AND ( CITYX Ф CITYY OR CITYY Ф CITYZ OR CITYZ Ф CITYX ) ) 7.14.20. ( SX, PX, JX ) WHERE EXISTS CITYX EXISTS CITYY EXISTS CITYZ { S ( Si:SX, CITY:CITYX ) AND P { P#:PX, CITY:CITYY ) AND J ( J#:JX, CITY:CITYZ ) AND ( CITYX Ф CITYY AND CITYY Ф CITYZ AND CITYZ Ф CITYX ) ) 7.14.21.PX WHERE EXISTS SX { SPJ { P#:PX, S#:SX ) AND S ( S#:SX, CITY:London ) ) 7.14.22. PX WHERE EXISTS SX EXISTS JX ( SPJ ( S#:SX, P#:PX, J#:JX ) AND S { S#:SX, CITY:London ) AND J { J#:JX, CITY:London ) 7.14.23. { CITYX AS SCITY, CITYY AS JCITY ) WHERE EXISTS SX EXISTS JY ( S ( S#:SX, CITY:CITYX ) AND J ( J#:JY, CITY:CITYY ) AND SPJ ( S#:SX, J#:JY ) ) 7.14.24.PX WHERE EXISTS SX EXISTS JX EXISTS CITYX ( S ( S#:SX, CITY:CITYX ) AND J ( J#:JY, CITY:CITYX ) AND SPJ ( S#:SX, P#:PX, J#:JX ) ) 7.14.25.JY WHERE EXISTS SX EXISTS CITYX EXISTS CITYY ( SPJ ( S#:SX, J#:JY ) AND S ( S#:SX, CITY:CITYX ) AND J ( J#:JY, CITY:CITYY ) AND CITYX Ф CITYY ) 7.14.26. { PX AS XP#, PY AS YP# ) WHERE EXISTS SX { SPJ ( S#:SX, P#:PX ) AND SPJ ( S#:SX, P#:PY ) AND PX < PY ) 7.14.27-7.14.30. Решения опушены. 7.14.31.NAMEX WHERE EXISTS JX { J { Ji:JX, JNAME:NAMEX ) AND SPJ ( S#:S# ( SI ), J#:JX ) ) 7.14.32.COLORX WHERE EXISTS PX { P ( Pi:PX, COLOR:COLORX ) AND SPJ { S#:S# { SI ), P#:PX ) ) 7.14.33. PX WHERE EXISTS JX ( SPJ { Pi:PX, J#:JX ) AND J ( J#:JX, CITY:London ) ) 7.14.34. JX WHERE EXISTS PX ( SPJ ( P#:PX, J#:JX ) AND SPJ { P#:PX, S#:S#{ SI ) ) ) 7.14.35. SX WHERE EXISTS PX EXISTS SY EXISTS PY { SPJ { S#:SX, P#:PX ) AND SPJ ( P#:PX, S#:SY ) AND SPJ { S#:SY, P#:PY ) AND P ( P#:PY, COLOR:COLOR ( Red ) ) ) 7.14.36.SX WHERE EXISTS STATUSX EXISTS STATUSY ( S ( S#:SX, STATUS:STATUSX ) AND S ( S#:S# ( SI ), STATUS:STATUSY ) AND STATUSX < STATUSY ) 7.14.37. JX WHERE EXISTS CITYX ( J ( J#:JX, CITY:CITYX ) AND FORALL CITYY ( IF J ( CITY:CITYY ) THEN CITYY > CITYX END IF) ) 7.14.38-7.14.39. Решения опушены. 7.14.40. JX WHERE J ( J#:JX ) AND NOT EXISTS SX EXISTS PX { SPJ ( S#:SX, P#:PX, J#:JX ) AND S { S#:SX, CITY:London ) AND P ( P#:PX, COLOR:COLOR ( Red ) ) ) 7.14.41. JX WHERE J ( J#:JX ) AND FORALL SX { IF SPJ { S#:SX, J#:JX ) THEN SX = S# ( SI ) END IF ) 7.14.42. PX WHERE P ( Pi:PX ) AND FORALL JX ( IF J ( J#:JX, CITY:London ) THEN SPJ ( P#:PX, J#:JX ) END IF ) 7.14.43. SX WHERE S ( S#:SX ) AND EXISTS PX FORALL JX { SPJ { S#:SX, P#:PX, J#:JX ) ) 7.14.44. JX WHERE J ( J#:JX ) AND FORALL PX { IF SPJ { S#:S# ( Si ), P#:PX ) THEN SPJ ( P#:PX, J#:JX ) END IF ) 7.14.45.CITYX WHERE EXISTS S { CITY:CITYX ) OR P { CITY:CITYX ) OR J ( CITY:CITYX ) 7.14.46.PX WHERE EXISTS SX ( SPJ ( Si:SX, P#:PX ) AND S ( S#:SX, CITY:London ) ) OR EXISTS JX ( SPJ ( J#:JX, P#:PX ) AND J ( J#:JX, CITY:London ) ) 7.14.47. ( SX, PX ) WHERE S ( Si:SX ) AND P ( Pi:PX ) AND NOT SPJ { S#:SX, P#:PX ) 7.14.48. ( SX AS XS#, SY AS YSi ) WHERE S ( S#:SX ) AND S ( S#:SY ) AND FORALL PZ ( ( IF SPJ ( S#:SX, P#:PZ ) THEN SPJ ( S#:SY, P#:PZ ) END IF ) AND ( IF SPJ ( S#:SY, P#:PZ ) THEN SPJ ( Si:SX, P#:PZ ) END IF ) ) 7.14.49-7.14.50. Решения опушены. 7.15. Мы перенумеровали решения этого пункта в виде 7.15.и, что соответствует номерам б.п в исходных упражнениях главы 6. 7.15.13. SELECT * FROM J ; или просто TABLE J :
|
© 2006 - 2024 pmbk.ru. Генерация страницы: 0
При копировании материалов приветствуются ссылки. |