You are on page 1of 28

DATABASE

SQL COMMANDS

Elizabeth Vinitha - ICT


What is a Database?

Elizabeth Vinitha - ICT


Elizabeth Vinitha - ICT
Elizabeth Vinitha - ICT
Example for a table

Elizabeth Vinitha - ICT


Elizabeth Vinitha - ICT
Elizabeth Vinitha - ICT
Elizabeth Vinitha - ICT
Elizabeth Vinitha - ICT
Elizabeth Vinitha - ICT
Elizabeth Vinitha - ICT
Commands

Elizabeth Vinitha - ICT


Datatypes

Elizabeth Vinitha - ICT


Basic syntax of CREATE TABLE statement

CREATE TABLE table_name( column1


datatype, column2 datatype, column3
datatype, ..... columnN datatype, PRIMARY
KEY( one or more columns ) );

Elizabeth Vinitha - ICT


EXAMPLE

Elizabeth Vinitha - ICT


Elizabeth Vinitha - ICT
www.sqlfiddle.com

Try from your home

Elizabeth Vinitha - ICT


Create Table login (
username varchar (20),
password varchar (20)
);

Elizabeth Vinitha - ICT


basic syntaxes of INSERT INTO statement

INSERT INTO TABLE_NAME (column1,


column2, column3,...columnN) VALUES
(value1, value2, value3,...valueN);

Here, column1, column2,...columnN are the names of the


columns in the table into which you want to insert data.

Elizabeth Vinitha - ICT


Elizabeth Vinitha - ICT
Elizabeth Vinitha - ICT
insert into login (username, password)
values(1, 'siva'),
(2, ' anu');

Elizabeth Vinitha - ICT


SELECT STATEMENT

Elizabeth Vinitha - ICT


select * from login;

Elizabeth Vinitha - ICT


Elizabeth Vinitha - ICT
Elizabeth Vinitha - ICT
Create a table called student
Fields/columns are ID, name, subject, mark

ID name subject mark


2 anu maths 90
5 manu science 68
6 tinu maths 89

Elizabeth Vinitha - ICT


ASSIGNMENT check you blog
DEADLINE for submission : 16 2- 2017

spgrade8.blogspot.ae

Elizabeth Vinitha - ICT

You might also like