|
Программирование >> Понятие sql
SELECT sname, city FROM Salespeople WHERE city = London AND comm > .10; SELECT * FROM Customers WHERE rating > 100 OR city Rome; SELECT * FROM Customers WHERE NOT rating < = 100 OR city = Rome; SELECT * FROM Customers WHERE NOT (rating < = 100 AND city < > Rome); Могут быть еще другие решения. onum 3001 3003 3005 3009 3007 3008 3010 3011 18.69 767.19 5160.45 1713.23 75.75 4723.00 1309.95 9891.88 odate 10/03/1990 10/03/1990 10/03/1990 10/04/1990 10/04/1990 10/05/1990 10/06/1990 10/06/1990 cnum 2008 2001 2003 2002 2004 2006 2004 2006 snum 1007 1001 1002 1003 1002 1001 1002 1001 onum 3001 3003 3006 3009 3007 3008 3010 3011 18.69 767.19 1098.16 1713.23 75.75 4723.00 1309.95 9891.88 odate 10/03/1990 10/03/1990 10/03/1990 10/04/1990 10/04/1990 10/05/1990 10/06/1990 10/06/1990 cnum 2008 2001 2008 2002 2004 2006 2004 2006 snum 1007 1001 1007 1003 1002 1001 1002 1001 SELECT * FROM Salespeople; SELECT * FROM Customers WHERE snum IN (1001,1004); SELECT * FROM Customers WHERE cname BETWEEN A AND H; ПРИМЕЧАНИЕ: В ASCII базовой системе Hoffman не будет выведен из-за конечных пробелов после H. По той же самой причине вторая граница не может быть G, поскольку она не выведет имена Giovanni и Grass. G может использоваться в сопровождении с Z, так чтобы следовать за другими символами в алфавитном порядке, а не предшествовать им, как это делают пробелы. SELECT * FROM Customers WHERE cname LIKE C%; SELECT * FROM Orders WHERE amt <> 0 AND (amt IS NOT NULL); SELECT * FROM Orders WHERE NOT (amt=0ORamtISNULL); Глава 6 SELECT COUNT(*) FROM Orders WHERE odate = 10/03/1990; SELECT * FROM Orders WHERE odate IN (10/03/1990,10/04/1990); 2. и SELECT * FROM Orders WHERE odate BETWEEN 10/03/1990 AND 10/04,1990; SELECT COUNT (DISTINCT city) FROM Customers; SELECT cnum, MIN (amt) FROM Orders GROUP BY cnum; SELECT MIN (cname) FROM Customers WHERE cname LIKE G%; SELECT city, MAX (rating) FROM Customers GROUP BY city; SELECT odate, count (DISTINCT snum) FROM Orders GROUP BY odate; Глава 7 SELECT onum, snum, amt * .12 FROM Orders; SELECT For the city , city, , the highest rating is , MAX (rating) FROM Customers GROUP BY city; SELECT rating, cname, cnum FROM Customers ORDER BY rating DESC; SELECT odate, SUM (amt) FROM Orders GROUP BY odate ORDER BY 2 DESC;
|
© 2006 - 2025 pmbk.ru. Генерация страницы: 0
При копировании материалов приветствуются ссылки. |