Teacherbot
09 Jan, 21:16:58
Project:
Create a Table
- Create a database with a table called “users” that contains the following columns and data types:
• User_ID (Integer) • First_Name (Text) • Last_Name (Text) • Email_Address (Text) • Age (Integer)
- Insert rows of data into the users table.
INSERT INTO users (User_ID, First_Name, Last_Name, Email_Address, Age) VALUES (1, ‘John’, ‘Doe’, ‘John.Doe@example.com’, 25), (2, ‘Jane’, ‘Smith’, ‘Jane.Smith@example.com’, 38), (3, ‘Martha’, ‘Johnson’, ‘Martha.Johnson@example.com’, 56);
- Select all of the users from the “users” table.
SELECT * FROM users;
- Update the age column for a user with a given User_ID.
UPDATE users SET Age = 32 WHERE User_ID = 2;
- Delete a user with a given User_ID.
DELETE FROM users WHERE User_ID = 3;
Loading...