How to CRUD in SQL

Brian Ryu
3 min readMar 1, 2019

(Basic SQL To-Know)

What is CRUD and what is it used for?

In the world of technology, databases are used everyday to store and access data. SQL stands for Structured Query Language. SQL is the fundamental language used to communicate with databases and is the standard language for relational database management systems. Through SQL queries, data is “created”, “read”, “updated” and “deleted” (CRUD).

CRUD in SQL are the four basic functions used for data storage. SQL methods are used to ‘create’ tables of data for future access. Tables are broken down into columns (vertical) and rows (horizontal). Columns will hold the specific column-name and the rows will consist of values of the specific columns. In this article, we will review the basics on how to ‘CRUD’ in SQL language by retrieving/changing/manipulating data in any database table.

Follow these four SQL methods in order to access and manipulate data in database tables:

Create:

CREATE TABLE “table_name” (“column1” “data_type”, “column2” “data_type”, “column3” “data_type”);

Read:

‘SELECT’ is used when querying a database to ‘read’ specific data.

Select all from the “dancers” table where the genre is equal to “Hip Hop”.
There are operators that can be used in the conditional statement when querying databases.

Update:

The first type of update we will review is the option to update a table with a new row of data by using the ‘INSERT INTO’ method.

User can add 1 or more column(s) with the appropriate 1 or more value(s).

The second type of update is updating an already existing row of data in the table.

Here we access the row of data in the dancers table where the value of the ‘name’ column is currently “Brian” and update to a new value of “Bryan”.

Delete:

Deleting Records

In order to delete records(rows) from a table, run the “DELETE” method. This will delete the entire row of data where the condition meets true.

Delete the row of data from the dancers table where the column name is equal to a value of “Bryan”.

Another option of delete is to “DROP”. Running a “DROP” with a specified table_name will delete the entire table.

This query will delete the entire ‘dancers’ table.

Now you are ready to create, change and access database tables! The methods reviewed are few of the many fascinating functions of the SQL language and are used in everyday database queries. There are more advanced query methods; with the knowledge and understanding of the listed CRUD methods above, challenge yourself to learn more!

--

--