1K Blog Marathon: Day 63
In Database Administration, a program connected to a database may perform different functions, mainly composed of what we are calling C.R.U.D. These are the four basic functions we will cover in this post.
C – Create
This function is used to create or insert new item into the database. When inserting new record, a new row will be created for the new record. In SQL, it is represented by the “INSERT INTO” function.
Ex.
INSERT INTO Table1 (column1) VALUES ('value1');
R – Read
Reading database and showing results is the most used function. It can simply show all records, or show filtered results. It is represented by “SELECT *” (read as select all), or by “SELECT [column name]”.
Ex.
SELECT * FROM Table1;
SELECT column1 FROM Table1;
SELECT * FROM Table1 WHERE column1 = "value";
U – Update
When an item or record is already existing, we can edit this record by using update function. This is represented by “UPDATE” function.
Ex.
UPDATE Table1 SET column1 = "value";
UPDATE Table1 SET column2 = "value2" WHERE column1 = "value1";
D – Delete
Delete function is used when we want to remove a record permanently from the database. This operation is represented by “DELETE”.
Ex.
(This deletes all record from the Database)
DELETE FROM Table1;
(This deletes one record from the Database)
DELETE FROM Table1 WHERE column1 = "value1";
That’s it guys! I hope you learned something from my blog post today. Thank you and happy coding! ^_^
“And that’s one blog, stay hungry!”
“Without a systematic way to start and keep data clean, bad data will happen.”
Donato Diorio