Learn SQL Queries Part1

 


SQL Queries using MySQL Database Part-1



coding-zon--mysql-queries-tutorial

Understanding an RDBMS Relational Database Management System(RDBMs), stores all information/data  in the form of Tables. 

Understanding a Relational Database
A single database can contain many tables, and they can be linked together.
When the tables are linked together, it's said to be a relational database.

 

Understanding Tables, Records and Fields in RDBMS

Table: Collection of rows and columns
Row:  Collection of inter related columns.
Field:  A piece of information of particular entity.

 

coding-zon-mysql-introduction

Menu Top

Table structure/design: 


example:

FieldName             Datatype
Id                            Number
First_Name            Text
Last_Name            Text
Address                 Text


Understanding Primary and Foreign Keys
 

Primary key:Identifies each record in table with unique id.

example:

  • account_no
  • roll_no
  • customer_no
  • emp_no..etc

Foriegnkey:

A foreign key is a field (or fields) that points to the primary key of another table.
A foreign key is a column, or combination of columns, that contain values that are found in the primary key of some table.
 

TopMenu 

Understanding SQL and SQL Queries

 

SQL(Structured Query Language): 

Used to interact with the Databases. There are plenty of SQL Queries that are used to query the data. Basically, they are categorized into 3 groups.

  1. DDL
  2. DML
  3. DCL

1. DDL(Data Definition Language): All the commands in this category are used on table definition(design/structure) such as creating , changing field name, datatype, size, add or remove fields etc, you can also find commands for creating, altering or deleting any database objects such as user,view etc.
  •  Create
  •  Alter
  •  Drop  
2. DML(Data Manipulation Language): These are commands used on table data.
  •  Select
  •  Insert
  •  Update
  •  Delete

3. DCL(Data Control Language):These command are used for securing data.

  • Grant
  • Revoke


In the next blog, we will discuss in detail on the above stated commands. Please follow the Link given below.




Comments