SQL Tutorial: Learn How SQL Works

SQL Coding Class San Francisco

SQL is an acronym for Structured Query Language, and it is used by web developers all over the world. In this SQL tutorial, we will introduce you to what SQL is, how it works and how to begin using it. While it won’t cover anywhere near the full breadth of options available to you, it should provide enough information to get you started, especially if you plan to supplement it by enrolling in a web coding bootcamp.

What Is SQL?

SQL was created to easily and efficiently retrieve and manage data in relational databases and is used as the standard language for Relational Database Systems (RDBMS). This includes common RDBMS like Oracle, MySQL, Informix, Sybase, MS Access, SQL Server and Postgres. If you want to use an RDBMS, you will need to have a working proficiency in SQL.

Put simply, SQL is a programming language used to create and operate databases with tools like fetching and modifying rows, deletion and more. SQL is an American National Standards Institute (ANSI) standard language. However, like every language, it comes with variants and dialects unique to specific contexts.

The Benefits of Mastering SQL

SQL is an important standard language for a multitude of web development tools, but it’s important to remember that SQL is not the same in each RDBMS. Different systems often use their own dialects of SQL. For example, MS Access uses a version of SQL called JET SQL, while Oracle uses PL/SQL and MS SQL uses T-SQL

SQL has a wide range of practical coding applications. Since it is one of the most widespread query languages in databases, knowing it gives developers a serious edge in designing functional projects because it lets users access data in an RDBMS as well as describe data, define it within the database and manipulate it. 

With SQL, users can embed within other languages by using modules, pre-compilers and libraries. Users can also create and drop tables and databases, set permissions on procedures, tables and views, as well as create stored procedures and functions within RDBMSs.

First Steps in Using SQL

If you want to execute a command in SQL for the RDBMS you use, the system itself decides the best way to execute your commands because the SQL engine does the work of interpreting the tasks. There are a few components you should be aware of:

  • Optimization Engines
  • Classic Query Engine
  • Query Dispatcher
  • SQL Query Engine

Non-SQL queries are handled by a classic query engine. However, an SQL engine will not handle logical files. SQL commands are classified into groups determined by their nature. Standard SQL commands include CREATE, INSERT, SELECTION, DROP, UPDATE AND DELETE and can be used to interact with relational databases. 

DDL — Data Definition Language

CREATE

Use CREATE to make new tables, views of tables and other database objects.

ALTER

Use ALTER to modify existing objects within databases, like tables.

DROP

DROP allows you to delete a table, a view of a table and other objects contained within your database.

DML — Data Manipulation Language

SELECT

Using SELECT lets you retrieve records from tables.

INSERT

INSERT can be used to create a record.

UPDATE

Use UPDATE to modify records.

DELETE

DELETE, as the name suggests, will delete records.

DCL — Data Control Language

GRANT

Use GRANT to grant privileges to users.

REVOKE

REVOKE allows you to revoke any privileges you have granted to users.

Deciphering RDBMS

As mentioned above, your RDBMS is the basis for SQL and for all modern databases, including IBM DB2, MySQL, MS SQL Server, Microsoft Access and Oracle. RDBMSes are database management systems that are based on a relational model. 

Tables

Data in an RDBMS is stored in tables, or groupings of related data entries, with a number of rows and columns into which its data is arranged. Tables are the simplest, most common form of data you will find stored in relational databases. 

Fields

Tables are individually divided into fields, or columns in tables, designed to store specific information about the records contained in the rest of the table.

Records and Rows

Records or rows of data are all the individual entries, or horizontal entities, existing in tables.

Columns

Columns are the vertical entities contained within tables and contain any information associated with specific fields in tables. 

NULL Values

NULL values are fields that appear blank within tables. These fields have a NULL value — in other words, they have no value at all, however, they are quite distinct from zero values and fields containing spaces. This distinction is important to understand, as fields that have NULL values have been left blank during the creation of a record. 

Constraints

SQL uses constraints as rules for the data columns contained in tables. Constraints are designed to limit the types of data that can be stored in tables and ensure that the data is accurate and reliable. You will see constraints at the table or column level; table level constraints are applied to whole tables, while column level constraints apply only to a single column.

Next Steps in SQL

SQL tutorials like this one are designed to introduce you to the fundamentals of the language. That said, there is plenty to learn from here, and this tutorial can only give you a platform to start. If you are not already enrolled in a web coding bootcamp, consider signing up for one to learn SQL and other programming languages alongside fellow web developers. Learning SQL requires time, dedication and practice. Having a community working toward your goals with you can make learning far easier and provides plenty of advantages for problem-solving, critical thinking and project design.

*Please note, these articles are for educational purposes and the topics covered may not be representative of the curriculum covered in our boot camp. Explore our curriculum to see what you’ll learn in our program.

Get Program Info

The following requires your attention:
Back
Back
Back
Back
Back
Back
Back
Back
Back
Back
0%

Ready to learn more about Berkeley Coding Boot Camp in San Francisco? Contact an admissions advisor at (510) 306-1218.