SEQL - vijayetar/seattle-301d55 GitHub Wiki

SEQL Structured Query Language

CheatSheet

It is the query language that works with database.

Relational database is a place to store data.

COMMANDS

  • What do we do with the data : SELECT To retrieve data from a SQL database, we need to write SELECT statements, which are often colloquially refered to as queries. A query in itself is just a statement which declares what data we are looking for, where to find it in the database, and optionally, how to transform it before it is returned.
    INSERT e.g. INSERT INTO name-of-table(column-name,another-col-name)VALUES('value','value');
    UPDATE
    DELETE
  • choose columns
    ALL = *
  • from where it is coming from
    FROM table name
  • how to filter it
    WHERE

Schema.sql

DROP TABLE IF EXISTS people; CREATE TABLE people { id SERIAL PRIMARY KEY, first_name VARCHAR(255), last_name VARCHAR(255) };

INSERT INTO poeple (first_name, last_name) VALUES ('Jin','Kim');


In terminal put - psql psql -f schema.sql -d (tablename)