Coding Basics: CRUD

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

Published by Christian Foster

Code-blooded, coffee-lover, tall, dark and chubby. I love to draw, has motion-sickness and a sleepy-head. BTW, graduate of BS Computer Science, Associate in Computer Science and certified UiPath RPA Developer. Loyal to my partner and a father of a cute bouncing baby daughter!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website at WordPress.com
Get started
%d bloggers like this: