News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

SQL Cheat Sheet [2020 Update]

Started by sushmi, Aug 12, 2020, 12:12 PM

Previous topic - Next topic

sushmi

SQL Cheat Sheet [2020 Update]

Create Database and table commands

Command

CREATE DATABASE DATABASE;

CREATE DATABASE NOT EXISTS database1;

CREATE DATABASE IF NOT EXISTS database1 CHARACTER SET latin1 COLLATE latin1_swedish_ci

SHOW DATABASES

CREATE TABLE [IF NOT EXISTS] TableName (fieldname dataType [optional parameters]) ENGINE = storage Engine;

Description

Create database

IF NOT EXISTS let you to instruct MySQL server to check the existence of a database with a similar name prior to creating database.

the Latin1 character set uses the latin1_swedish_ci collation which is the Swedish case insensitive order.

You can see list of existing databases by running following SQL command.

Create table syntax

MySQL DELETE command

Command                                                                    Description
DELETE FROM table_name [WHERE condition];          Delete a row in MySQL

Example :-
DELETE FROM table1 WHERE table1_id = 18;
(delete entry of 18 number id form table1.)
DELETE FROM table1 WHERE table1_id IN (20,21);
(delete entry of 20 and 21 number id form table1)