• Examples
  • Sample Database
#1
CREATE TABLE contacts (
	first_name text NOT NULL,
	last_name text NOT NULL,
	email text NOT NULL
);
#2
CREATE UNIQUE INDEX idx_contacts_email ON contacts (email);
#3
INSERT INTO contacts (first_name, last_name, email)
VALUES
	(
		'John',
		'Doe',
		'[email protected]'
	);
#4
INSERT INTO contacts (first_name, last_name, email)
VALUES
	(
		'Johny',
		'Doe',
		'[email protected]'
	);
#5
INSERT INTO contacts (first_name, last_name, email)
VALUES
	(
		'David',
		'Brown',
		'[email protected]'
	),
	(
		'Lisa',
		'Smith',
		'[email protected]'
	);
#6
SELECT
	first_name,
	last_name,
	email
FROM
	contacts
WHERE
	email = '[email protected]';
#7
CREATE INDEX idx_contacts_name 
ON contacts (first_name, last_name);
#8
DROP INDEX idx_contacts_name;
albums artists customers employees genres invoice_items invoices media_types playlist_track playlists tracks
  • SQL Query
Enter a query, then click the execute button or press F9 to run it.
  • Result
Loading