DEV Community

hoganbyun
hoganbyun

Posted on

Commands in SQL

If you are planning to one day work with and manage data, chances are, you will eventually have to work with SQL (Structured Query Language). SQL is a language used to communicate with databases, most often used to update data or retrieve specific parts or groups in the data. If any task involves manipulating or creating a database, SQL will work well.

In a previous post, I went over common SQL clauses, most specifically, those used to pull data from databases. In this post, I will go over some commands that are more relevant when creating or modifying a database.

Common Commands

CREATE DATABASE - makes a new database
CREATE TABLE - makes a new table; databases are, in essence, a collection of tables
UPDATE - changes or updates data
INSERT INTO - inserts new data
DELETE - deletes selected data
DROP - deletes tables/databases
SELECT - indicates what you want to pull from the data (also covered in a previous post)

Here are some important distinctions to make note of. Databases and tables are both collections of data, but a database is a collection of tables. DROP and DELETE differ as DELETE is used on specific data while DROP refers to whole tables or databases. SELECT allows you to pull specific features of the data, but doesn't really manipulate it like the other commands listed.

Discussion (0)