Creating A Database The Syntax For Creating The Database

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

SQL is a database computer language designed for the retrieval and management of

data in a relational database. SQL stands for “Structured


Query Language”.
SQL is the Structured Query language which is a computer language for storing
manipulating and retrieving data stored in the relational database. It allows users to
create and drop tables. It allows users to describe the data. It allows users to set
permissions on tables, procedures and views. All the Relational Database
Management systems (RDBMS) like MySQL, MS Access, Oracle use SQL as their
standard database language. We use sqlyog application for doing queries.

Creating a database The syntax for creating the database


is:
CREATE DATABASE
<database name>;

Deleting a Database: The syntax for deleting a database is:


DROP DATABASE <database name>;

Creating tables
The syntax to create a table in SQL is:

CREATE TABLE TABLE_NAME(


ATTRIBUTE1 DATA_TYPE,
ATTRIBUTE 2 DATA_TYPE,
ATTRIBUTE 3 DATA_TYPE
);
Inserting values
The syntax to insert the values in the table
is:
INSERT INTO TABLE NAME(attr1, attr2, attr3……)
VALUES (val1, val2, val3…….);

Below are few that tables I created and inserted Data


Various syntax in SQL
1. SQL SELECT statement:
Syntax:
SELECT column1, column2… column N
FROM table name;
2. SQL WHERE clause
SELECT colum1,col2… col N
FROM table_name
WHERE CONDITION;

3. SQL UPDATE statement


UPDATE tablename
SET column1=value1, column2= value 2……….columnn=valuen
WHERE condition;

You might also like