SQL Archive

Foreign Keys Made Simple with MySQL by examples

In plain English : A FOREIGN KEY in one table points to a PRIMARY KEY in another table. A foreign key places constraints on data in the related tables to ensure and guarantee data referential integrity as well as consistency. Foreign Key Syntax: create table abc( abc_id int not null ..... ... ...Read More

SQL SELECT Tutorial for Nested Queries ( Sub Queries )

A Subquery or Inner query or Nested query is a query within another SQL query and embedded within the WHERE clause. A subquery is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved. Subqueries can be used with ...Read More

SQL tutorial for using Having with Examples

The HAVING statment  is added to SQL because the WHERE keyword could not be used with aggregate functions ( such as count, max …) [info] Advanced SQL SELECT Tutorial using Aggegrate Functions by Examples [/info] The syntax for using HAVING is as below:   SELECT column_name, aggregate_function(column_name) FROM table_name WHERE column_name operator ...Read More

Advanced SQL SELECT Tutorial using Aggegrate Functions by Examples

[info]In case you are beginner with SQL, you are advised to visit the following tutorials: >SQL SELECT Tutorial : Searching & Querying the database >Join : SELECT Tutorial using multiple database tables[/info] The important SQL command is SELECT statement. The SQL SELECT statement is used to query or retrieve data from a ...Read More

SQL Simple Exercises using MySQL and phpMyAdmin

[info]If you have not installed MySQL/phpMyAdmin, Follow this tutorial to install EasyPHP[/info] 1 Open phpMyAdmin. Click : Databases to create a new database with the name : ecommerce, Click Create 2 Click on the database ecommerce on the left side. 3 Download the database ecommerce.sql file. [info]Click here Download the ecommerce.sql file ...Read More

Database Porgramming : Creating a simple phone book using Java & a database ( HSQLDB )

[info] You to have Java and Eclipse Configured and Installed. If not please install the JDK and download Eclipse[/info] In one of the last tutorial, we have created a simple phonebook system using a text file and Java Programming. For more details, click here. In this tutorial, we will be creating the ...Read More

Join : SELECT Tutorial using multiple database tables

The JOIN is used in an SQL statement to query data from two or more tables, based on a relationship between certain columns in these tables. Tables in a database are often related to each other with keys. [info] In case you are not familiar with SELECT, visit this tutorial : SQL ...Read More

SQL SELECT Tutorial : Searching & Querying the database

The most commonly used SQL command is SELECT statement. The SQL SELECT statement is used to query or retrieve data from a table in the database. A query may retrieve information from specified columns or from all of the columns in the table. To create a simple SQL SELECT Statement, you must ...Read More

SQL Tutorial : Creating a Table and Inserting data ( MySQL & HSQLDB )

In this tutorial, we will learn how to create a database table and insert data into it,   The example we will consider is a simple phone book to store names, last names, ages, email and phone numbers for people. What is SQL? SQL stands for Structured Query Language SQL lets you ...Read More

SQL Hello World: A simple guide to database systems using HSQLDB

In this tutorial, we will learn how to create a simple database and play with its content. The example we will consider is a simple phone book to store names, last names and phone numbers for people. 1) We need to download the DBMS  ( HSQLDB ): [a software that eases and ...Read More