$ settings --editor

$ settings --general

$ save --settings

SQL for beginners

Changing a table with ALTER TABLE #

Once a table already has data in it, you can't just recreate it from scratch to change its structure. The ALTER TABLE statement lets you modify an existing table in place. The most common use is adding a new column:

ALTER TABLE table_name
ADD COLUMN column_name;
  • table_name: The table to change.
  • ADD COLUMN column_name: Adds a new column to every row of the table. Existing rows get NULL for the new column, since there is no value for it yet.

Exercise #

Write a command that adds a new column called email to the customers table, without changing any of the existing rows.

Tests #

  • The customers table now has an email column.
  • The customers table still has the same number of rows as before.
Solution
ALTER TABLE customers
ADD COLUMN email;
Output will be displayed here