CRUD Flashcards
How to do an insert to the table “employees” the columns “id”, “name” and “title”?
INSERT INTO employees(id, name, title)
VALUES (1, ‘Allan’, ‘Engineer’);
Does SQL support UUID?
NO
Which function to user to retrieve the number of records of a column?
COUNT
How to delete employee with id equal to 251 from the “employees” table?
DELETE from employees WHERE id = 251;
2 ways to protect agains losing data on DELETE?
- Backup
- Soft delete
What is a soft delete?
A “soft delete” is when you don’t actually delete data from your database, but instead just “mark” the data as deleted
Write an SQL query to update the “job_title” and “salary” for an employee with the ID of 251 in the ‘employees’ table, setting the job title to ‘Backend Engineer’ and the salary to 150000?
UPDATE employees
SET job_title = ‘Backend Engineer’, salary = 150000
WHERE id = 251;
What ORM stands for?
Object Relational Mapping
What is an ORM?
A tool that allows you to perform CRUD operations on a database using a traditional programming language.