SET TRANSACTION READ ONLY; Bu operator tranzaksiya jarayoni boshlanishidan oldin ko'rsatiladi. Masalan, EXEC SQL SET TRANSACTION READ ONLY; Buyurtmalarni qabul qilgan sotuvchini aniqlamoqchmiz. Bu ikki so'rovni birbiridan farq qilishi uchun matn kiritish yo'li bilan tashkillashtirisimiz mumkin: SELECT a.snum, sname, onum, 'Highest on', odate FROM Salespeople a. Orders b WHERE a.snum = b.snum AND b.amt = (SELECT MAX (amt) FROM Orders с WHERE c.odate = b,odate)
UNION SELECT a.snum, sname, onum, 'Lowest on', odate FROM Salespeople a, Orders b WHERE a.snum b.snum AND b.amt = (SEi FCT MIN (amt)FROM Orders с
10 Peel
30
High o 10/05/
10 Peel
30
Low o 10/05/
10 Peel
30
High o 10/06/
10 Serre
30
High o 10/03/
10 Serre
30
Low o 10/04/
10 Serre
30
Low o 10/06/
10 Axel
30
High o 10/04/
.
Shu paytgacha UNION kalit so'zi yordamida birlashtirilgan so'rov natijalari qanday tartibda matnga chiqarilishi to'g'risida gapirmadik. Birlashtirilgan natijalarni ORDER BY kalit so'zi yordamida tartiblashtirish mumkin. Yoqoridagi misolni tartub raqamlariga nisbatan tartiblashni ko'rib o'tamiz. SELECT a.snum, sname, onum, 'Highest on', odate FROM Salespeople a. Orders b WHERE a.snum = b.snum AND b.amt = (SELECT MAX (amt) FROM Orders с WHERE c.odate = b.odate) UNION SELECT a.snum, sname, onum. 'Lowest on', odate F ROM Salespeople a. Orders b WHERE a.snum = b.snu AND b.amt = (SELECT MIN (amt) FROM Orders с WHERE c.odate = b.odate) ORDER BY 3; Natija quyidagicha: