MySql

  • SELECT * FROM Customers;
  • SELECT CustomerName, City, Country FROM Customers;
  • SELECT DISTINCT Country FROM Customers;
  • SELECT COUNT(DISTINCT Country) FROM Customers;
  • SELECT * FROM Customers
  • WHERE Country=’Mexico’;
  • SELECT * FROM Customers
  • WHERE City=’Berlin’ OR City=’Stuttgart’;
  • SELECT * FROM Customers
  • WHERE Country=’Germany’ OR Country=’Spain’;
  • SELECT * FROM Customers
  • WHERE Country=’Germany’ AND (City=’Berlin’ OR City=’Stuttgart’);
  • SELECT * FROM Customers
  • ORDER BY Country;
  • SELECT * FROM Customers
  • ORDER BY Country DESC;
  • SELECT * FROM Customers
  • ORDER BY Country, CustomerName;
  • SELECT * FROM Customers
  • ORDER BY Country ASC, CustomerName DESC;
  • SELECT CustomerName, ContactName, Address
  • FROM Customers
  • WHERE Address IS NULL;
  • SELECT * FROM Customers
  • WHERE Country=’Germany’
  • LIMIT 3;
  • SELECT *
  • FROM Products;
  • SELECT MIN(Price) AS SmallestPrice
  • FROM Products;
  • SELECT COUNT(ProductID)
  • FROM Products;
  • SELECT AVG(Price)
  • FROM Products;
  • SELECT *
  • FROM OrderDetails;
  • SELECT SUM(Quantity)
  • FROM OrderDetails;
  • SELECT *
  • FROM Customers
  • WHERE CustomerName LIKE ‘a%’;
  • SELECT *
  • FROM Customers
  • WHERE CustomerName LIKE ‘%a’;
  • COUNT(DISTINCT Country)