Skip to content

Instantly share code, notes, and snippets.

@gbarreiro
Created August 20, 2020 12:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbarreiro/32cc35f1012f88a73f2de2f9067d39d2 to your computer and use it in GitHub Desktop.
Save gbarreiro/32cc35f1012f88a73f2de2f9067d39d2 to your computer and use it in GitHub Desktop.
MySQL cheatsheet: create view
-- The sentence below...
SELECT (id, name, age) FROM Students UNION ALL SELECT (id, name, age) FROM Teachers;
-- ... is the same than...
CREATE VIEW People AS SELECT (id, name, age) FROM Students UNION ALL SELECT (id, name, age) FROM Teachers;
SELECT * from People;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment