SQL for Data Analysis

SQL for Data Analysis

Standard Query Language

Structured Query Language (SQL) is used to manage relational databases. It creates, modifies, and queries databases by managing the data stored in the tables. SQL is used in a variety of settings, from small businesses to large corporations, and it is essential for anyone who works with data to have a basic understanding of SQL.

This article introduces SQL, covering its history, syntax, basic concepts, and some common commands. By the end of this article, readers will have a basic understanding of SQL and be able to start using it to manage data.

History of SQL

SQL was first introduced in the 1970s by IBM researchers Donald Chamberlin and Raymond Boyce. At the time, it was called SEQUEL, which stood for Structured English Query Language. The name was later changed to SQL to avoid trademark issues.

In the 1980s, SQL became the standard language for managing relational databases, and it was adopted by the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO).

Today, SQL is widely used in the tech industry and is an essential skill for anyone who works with data. It is used in a variety of settings, from small businesses to large corporations, and it is essential for anyone who works with data to have a basic understanding of SQL.

Database

A database is a collection of related information it keeps track of products and enhances the security of information

Database Management System (DBMS)

It is a special software program that helps users create and maintain a database it manages large amounts of information, Handles Security, Backups, Import and Exports Data

Types of Database

  1. A relational Database Organizes data into one or more tables Each table has columns and rows and a unique key identifies each row

  2. Non-Relational Database(no SQL) Include documents such as .json, .xml files

Types of Database management systems

  1. Relational Database Management systems(RDBMS). They help users create and maintain Relational DB. They include:
  • MySQL

  • Oracle

  • Postgre SQL

  • MariaDB

  1. Non-RDBMS

They help create and maintain a non-relational database management system. They include:

  • MongoDB

  • DynamoDB

  • Apache

SQL Types

  1. Data Query Language

    • used to query databases for information
  2. Data Definition Language

    • defines database schemas
  3. Data Control Language

    • controls access to data in the Database
  4. Data Manipulation Language

  • used for inserting, updating, and Deleting

SQL syntax

Some of The Most Important SQL Commands

  • SELECT - extracts data from a database

  • UPDATE - updates data in a database

  • DELETE - deletes data from a database

  • INSERT INTO - inserts new data into a database

  • CREATE DATABASE - creates a new database

  • ALTER DATABASE - modifies a database

  • CREATE TABLE - creates a new table

  • ALTER TABLE - modifies a table

  • DROP TABLE - deletes a table

  • CREATE INDEX - creates an index (search key)

  • DROP INDEX - deletes an index

SQL is used to perform C.R.U.D. operations

C - create

R- Read/retrieve

U - update

D - Delete

CREATE

CREATE TABLE table_name (
    column1 datatype,
    column2 datatype,
    column3 datatype,

);