Mysql select SELECT salary FROM staff where salary60000

  • Slides: 22
Download presentation

БД. Mysql. select Знаки =, !=, >, , < SELECT salary FROM `staff` where

БД. Mysql. select Знаки =, !=, >, , < SELECT salary FROM `staff` where salary!=60000 DISTINCT select DISTINCT age from employee_data ORDER BY age; Функция LIKE SELECT * FROM table WHERE column LIKE '%инфо%' SELECT * FROM testtable WHERE name NOT LIKE '%kk%';

БД. Mysql/Сортировка http: //www. mysqltutorial. org SELECT column 1, column 2, . . .

БД. Mysql/Сортировка http: //www. mysqltutorial. org SELECT column 1, column 2, . . . FROM tbl ORDER BY column 1 [ASC|DESC], column 2 [ASC|DESC], . SELECT contact. Lastname, contact. Firstname FROM customers ORDER BY contact. Lastname; contact. Lastname contact. Firstname Accorti Paolo Altagar, G M Raanan Andersen Mel Anton Carmen

БД. Mysql/Сортировка. Обратный порядок http: //www. mysqltutorial. org SELECT contact. Lastname, contact. Firstname FROM

БД. Mysql/Сортировка. Обратный порядок http: //www. mysqltutorial. org SELECT contact. Lastname, contact. Firstname FROM customers ORDER BY contact. Lastname DESC; contact. Lastname contact. Firstname Young Jeff Young Julie Young Mary Young Dorothy

БД. Mysql/Сортировка по нескольким полям http: //www. mysqltutorial. org SELECT contact. Lastname, contact. Firstname

БД. Mysql/Сортировка по нескольким полям http: //www. mysqltutorial. org SELECT contact. Lastname, contact. Firstname FROM customers ORDER BY contact. Lastname DESC , contact. Firstname ASC; contact. Lastname contact. Firstname Young Dorothy Young Jeff Young Julie Young Mary

БД. Mysql/Сортировка по нескольким полям http: //www. mysqltutorial. org SELECT ordernumber, orderlinenumber, quantity. Ordered

БД. Mysql/Сортировка по нескольким полям http: //www. mysqltutorial. org SELECT ordernumber, orderlinenumber, quantity. Ordered * price. Each FROM orderdetails ORDER BY ordernumber , order. Line. Number, quantity. Ordered * price. Each; ordernumber orderlinenumber quantity. Ordered * price. Each 10100 1 1729. 21 10100 2 2754. 50 10100 3 4080. 00 10100 4 1660. 12

БД. Mysql/LIMIT http: //www. mysqltutorial. org SELECT column 1, column 2, . . .

БД. Mysql/LIMIT http: //www. mysqltutorial. org SELECT column 1, column 2, . . . FROM table LIMIT N; SELECT customernumber, customername, creditlimit FROM customers LIMIT 2; customernumb er customername creditlimit 103 Atelier graphique 21000. 00 112 Signal Gift Stores 71800. 00

БД. Mysql. select.

БД. Mysql. select.

SELECT/GROUP BY SELECT DISTINCT status FROM orders; status Shipped Resolved Cancelled On Hold Disputed

SELECT/GROUP BY SELECT DISTINCT status FROM orders; status Shipped Resolved Cancelled On Hold Disputed In Process

SELECT/GROUP BY SELECT order. Number, SUM(quantity. Ordered * price. Each) AS total FROM orderdetails

SELECT/GROUP BY SELECT order. Number, SUM(quantity. Ordered * price. Each) AS total FROM orderdetails GROUP BY order. Number; order. Number total 10100 10223. 83 10101 10549. 01 10102 5494. 78 10103 50218. 95

SELECT/GROUP BY/having SELECT ordernumber, SUM(quantity. Ordered) AS items. Count, SUM(quantity. Ordered*priceeach) AS total FROM

SELECT/GROUP BY/having SELECT ordernumber, SUM(quantity. Ordered) AS items. Count, SUM(quantity. Ordered*priceeach) AS total FROM orderdetails GROUP BY ordernumber HAVING total > 1000; ordernumber items. Count total 10100 151 10223. 83 10101 142 10549. 01 10102 80 5494. 78 10103 541 50218. 95

SELECT/GROUP BY/having and SELECT ordernumber, SUM(quantity. Ordered) AS items. Count, SUM(quantity. Ordered*priceeach) AS total

SELECT/GROUP BY/having and SELECT ordernumber, SUM(quantity. Ordered) AS items. Count, SUM(quantity. Ordered*priceeach) AS total FROM orderdetails GROUP BY ordernumber HAVING total > 1000 AND items. Count > 600; ordernumber items. Count total 10106 675 52151. 81 10126 617 57131. 92 10135 607 55601. 84 10165 670 67392. 85

SELECT/insert INSERT INTO Customers (Customer. Name, Contact. Name, Address, City, Postal. Code, Country) VALUES

SELECT/insert INSERT INTO Customers (Customer. Name, Contact. Name, Address, City, Postal. Code, Country) VALUES ('Cardinal', 'Tom B. Erichsen', 'Skagen 21', 'Stavanger', '4006', 'Norway'); INSERT INTO Customers VALUES ('Cardinal', 'Tom B. Erichsen', 'Skagen 21', 'Stavanger', '4006', 'Nor