Facebook
From Saddam Fuhan, 3 Years ago, written in SQL.
Embed
Download Paste or View Raw
Hits: 51
  1. CREATE TABLE customers (
  2.         id NUMERIC PRIMARY KEY,
  3.         name VARCHAR,
  4.         street VARCHAR,
  5.         city VARCHAR,
  6.         state CHAR,
  7.         credit_limit REAL
  8. );
  9.  
  10. INSERT INTO customers (id, name, street, city, state, credit_limit)
  11. VALUES  (1, 'Pedro Augusto da Rocha', 'Rua Salto Grande', 'Niteroi', 'RJ', 700.00),
  12.                 (2, 'Antonio Carlos Mamel', 'Av. Pinheiros', 'Belo Horizonte', 'MG', 3500.50),
  13.                 (3, 'Luiza Augusta Mhor', 'Rua Salto Grande', 'Niteroi', 'RJ', 4000.00),
  14.                 (4, 'Jane Ester', 'Av 7 de setembro', 'Erechim', 'RS', 800.00),
  15.                 (5, 'Marcos Antônio dos Santos', 'Av Farrapos', 'Porto Alegre', 'RS', '4250.35')
  16.  
  17. SELECT name FROM curtomers WHERE state = 'RS';
  18.  
  19. --2603
  20. SELECT name, street FROM customers WHERE city = 'Porto Alegre';
  21.  
  22. --2604
  23. SELECT id, name FROM products WHERE price < 10 OR price > 100;