/practice-sql

Now-a-days using ORM very much, so getting very little chance to use raw SQL and hence forgetting it. Hence I started practicing SQL to refresh my knowledge.

Refreshing SQL knowledge

Used RDMS: PostgreSQL

What is PostgreSQL?

PostgreSQL is an object-relational database management system (ORDBMS) based on POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer Science Department. POSTGRES pioneered many concepts that only became available in some commercial database systems much later.

PostgreSQL is an open-source descendant of this original Berkeley code. It supports a large part of the SQL standard and offers many modern features:

  • complex queries
  • foreign keys
  • triggers
  • views
  • transactional integrity
  • multiversion concurrency control

Also, PostgreSQL can be extended by the user in many ways, for example by adding new

  • data types
  • functions
  • operators
  • aggregate functions
  • index methods
  • procedural languages

And because of the liberal license, PostgreSQL can be used, modified, and distributed by anyone free of charge for any purpose, be it private, commercial, or academic.

Instruction to practice on Ubuntu console:

Run below commands to practice queries

  • sudo su postgres
  • psql
  • Run sql commands now

Tutorial I followed:

Topics

  • Create Database
  • Create Table
  • Insert Query
  • General SELECT query
  • SQL-DISTINCT
  • SQL-ORDER-BY
  • SQL-LIMIT