A Beginner’s Guide to the SQL Language

A Beginner’s Guide to the SQL Language

SQL or Structured Query Language is used for accessing and manipulating a database. What Is SQL? How to Use SQL? What Is SQL Used For? SQL Database Systems You Should Know About. How to Learn SQL? Where to Ask for Help Learning SQL? How Long Does It Take to Learn SQL Language?

SQL or Structured Query Language is used for accessing and manipulating a database.

What is a database?

A database is a collection of structured and related information. A database is used to insert, retrieve, and update information in a time-efficient way.

Why a database is required?

Suppose you work in an organization and the organization employs more than 1000 employees. The organization needs a database that will have all the information of employees like Name, Sex, Age, Designation, Date of joining, etc.

The information in a database somewhat looks like the information in a spreadsheet, but the retrieval of this information is much faster as compared to spreadsheets.

Image for post

A spreadsheet containing employee data

A database may contain millions of records similar to records shown in the picture above. It is nearly impossible to update or retrieve millions of records from spreadsheets without causing your computer to crash.

To make your life easier, you can use a database and use SQL to retrieve, add, delete, or manipulate the existing data.

Let us assume that you already have a Database Management System (DBMS)installed on your computer. If it is not present then you can install any DBMS from the internet. SQLite, MySQL, Microsoft SQL server are some of the DBMS that can be used to create a database. I will be using Microsoft SQL server in this article.

Creating a database in DBMS.

This can be done by using Create database statement:

SYNTAX: Create database database_name;

Create database employees;

Image for post

employees database created

The next step will be to create tables in our employees database. We will be creating 2 tables, namely employees and salaries, in our employees database.

A database can contain tens or hundreds of tables

We can use the Create Table statement to create employees table having emp_no, first_name, birth_date, last_name, gender, hire_date as its columns (or attributes).

Create Table employees (emp_no INT,
birth_date DATE,
first_name VARCHAR(20),
last_name VARCHAR(20),
gender CHAR,
hire_date DATE,
PRIMARY KEY (emp_no)

Image for post

employees table created

In a similar fashion, salaries table with emp_no, salary, from_date, to_date columns can be created.

Create Table salaries (
emp_no INT,
salary INT,
from_date DATE,
to_date DATE

Image for post

salaries table created

Once we have created the employees and salaries tables, we need to insert data into those tables. This can be done using INSERT INTO statement

Insert INTO employees (emp_no,birth_date,first_name,last_name,gender,hire_date) VALUES (223,’1965–10–12', ‘John’, ‘Oliviar’, ‘M’,’2018–10–23');
Insert INTO employees (emp_no,birth_date,first_name,last_name,gender,hire_date) VALUES (225,’1968–04–20', ‘Emma’, ‘Masterson’, ‘F’,’2017–03–12');

Microsoft SQL server accepts YYYY-MM-DD format to insert dates

Image for post

Values inserted into employees table

Similarly, data can be loaded into salaries table.

Image for post

Values inserted into salaries table

sql database programming developer

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Introduction to Structured Query Language SQL pdf

SQL stands for Structured Query Language. SQL is a scripting language expected to store, control, and inquiry information put away in social databases. The main manifestation of SQL showed up in 1974, when a gathering in IBM built up the principal model of a social database. The primary business social database was discharged by Relational Software later turning out to be Oracle.

AlaSQL in Action: The JavaScript SQL Database

Overview on AlaSQL, the popular lightweight client-side in memory SQL database, including a real life example of AlaSQL in action. I was surprised to see that there aren’t more posts about this popular lightweight client-side in-memory SQL database online apart from this awesome article I found.

Backup Database using T-SQL Statements

Introduction In this article, We will discuss how to backup our database in MS-SQL Server using T-SQL Statements. We need to use BACKUP DATABASE statement to create full database backup, along with…

Build a Bank Database Using SQL | SQL For Beginners | SQL Applications

Bank Database using SQL, you will be working on an end-to-end project to build a database management system for a bank.

How long does it take to develop/build an app?

This article covers A-Z about the mobile and web app development process and answers your question on how long does it take to develop/build an app.