You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 25, 2018. It is now read-only.
CREATETABLEIF NOT EXISTS
users(
id SERIALPRIMARY KEYNOT NULL,
first_name VARCHAR(256) NOT NULL,
last_name VARCHAR(256) NOT NULL,
ssn INTEGERNOT NULL,
ninja_status BOOLEANNOT NULL,
biography TEXTNOT NULL
);
Deleting a table
DROPTABLE users;
Working with Records
Reading all record from the DB
SELECT*FROM users;
Reading a specific record from the DB
SELECT*FROM users WHERE id=3;
Inserting a new record
INSERT INTO users(first_name, last_name, ssn, ninja_status, biography)
VALUES('Flibbity', 'Jibbit', 333-44-5555, TRUE, 'By the time of the Meiji Restoration (1868), the tradition of the shinobi had become a topic of popular imagination and mystery in Japan. Ninja figured prominently in legend and folklore, where they were associated with legendary abilities such as invisibility, walking on water and control over the natural elements. As a consequence, their perception in popular culture is often based on such legend and folklore than on the spies of the Sengoku period.');
Updating an existing record
UPDATE users
SET
first_name='Flibbity',
last_name='Jibbit',
ssn=333-44-5555,
ninja_status=FALSE, -- We changed this value!!
biography='By the time of the Meiji Restoration (1868), the tradition of the shinobi had become a topic of popular imagination and mystery in Japan. Ninja figured prominently in legend and folklore, where they were associated with legendary abilities such as invisibility, walking on water and control over the natural elements. As a consequence, their perception in popular culture is often based on such legend and folklore than on the spies of the Sengoku period.'WHERE id=3;