Section 5 - CRUD Commands Flashcards
What are the 4 basic actions we can do with our data?
C - CREATE
R - READ
U - UPDATE
D - DELETE / DESTROY
What does CRUD stand for in MySQL? (As well as in other programming languages.
C - CREATE
R - READ
U - UPDATE
D - DELETE / DESTROY
Fill in the missing information:
C -
R - READ
U - UPDATE
D - DELETE
C - CREATE
Fill in the missing information:
C - CREATE
R -
U - UPDATE
D - DELETE
R - READ
Fill in the missing information:
C - CREATE
R - READ
U -
D - DELETE
U - UPDATE
Fill in the missing information:
C - CREATE
R - READ
U - UPDATE
D -
D - DELETE / DESTROY
What are the 4 fundamental manipulations of data?
Create, Read, Update, Delete / Destroy
Describe each of the 4 fundamental manipulations of data:
Create
Read
Update
Delete
Create - Add Data In
Read - Search It / Read it Back Out
Update It - Self-explanatory
Delete It - Self explanatory
Is CRUD unique to databases, or is it common in other practices of web development?
Common in other practices of web development.
What the command for deleting a table?
DROP TABLE ;
What is the basic command for retrieving and searching data from a database?
SELECT
What is the command for retrieving ALL of the data in a table?
SELECT * FROM ;
What is the command for retrieving a specific column of data in a table?
SELECT FROM ;
What is the command / syntax for retrieving multiple columns of data from a table?
SELECT , FROM ;
If you do a SELECT * FROM command, what order is the data shown in?
The data was shown in the order the table was initially setup.
For example, let's reference the following: CREATE TABLE dogs( name VARCHAR(100), breed VARCHAR(100), age INT );
If we did a SELECT * FROM dogs, the data would show in the order of name, breed, age.
When using SELECT statements, what command do we add to it to get more specific?
SELECT * FROM WHERE = [value]
Read the following statement:
SELECT * FROM cats WHERE breed=’tabby’;
Should there be single quotes around breed?
NO.
The syntax is correct as-is.
SELECT * FROM cats WHERE age=4;
Should there be quotes around ‘4’?
Why or why not?
No.
You don’t need quotes around 4, because it is an integer.
SELECT * FROM dogs WHERE name=Bartholemew;
Should there be quotes [ ‘ ‘ ] around Bartholemew?
Why or why not?
YES.
Because ‘Bartholemew’ is a string.
Correct syntax should be:
SELECT * FROM dogs WHERE name=’Bartholemew’;
YES or NO:
By default, are SELECT queries cAsE SenSitive?
NO, they are NOT case sensitive.
Write a command for selecting rows named ‘name’ and ‘breed’ from a table named ‘dogs’.
SELECT name, breed FROM dogs;
Write a query for a table named cats, where you select all cats’ names where their breed is ‘tabby’.
SELECT name FROM cats WHERE breed=’tabby’;
Write a query for a table named cats. SELECT all name and age for cats where the cat_id column equals the age column.
SELECT name, age FROM cats WHERE cat_id=age;
SELECT name, breed FROM dogs WHERE dog_id = age;
What does the above query do?
This prints all dog names and breeds where the dog_id (primary key) matches the dogs age.