Basic  Sql

Basic Sql

DATA TYPES IN SQL

There are a lot of data types in SQL:

But let's look into some important ones:

INT

A normal-sized integer that can be signed or unsigned. Range 0 to 4294967295.

VARCHAR

A variable length string between 1 and 255 characters in length. Length must be defined.

DATE

The date is written in YYYY-MM-DD format.

SIMPLE QUERIES IN SQL:

Show database

To list all databases on a MySQL server host you use the SHOW DATABASES command.

Create database

To create a database we use CREATE DATABASE command.

Drop database

To delete a database from the server we use the DROP DATABASE command.

To Create Table

For creating a table we write a simple query having the syntax:

CREATE TABLE <table_name> (column1 datatype, column2 datatype,column3 datatype,.........);

To insert values

For inserting values in the table we created we write a query having the syntax:

INSERT INTO <table_name> VALUES(value1,value2,value3,......);