SQL code example

Example 1: sql

SELECT - extracts data from a database
UPDATE - updates data in a database
DELETE - deletes data from a database
INSERT INTO - inserts new data into a database
CREATE DATABASE - creates a new database
ALTER DATABASE - modifies a database
CREATE TABLE - creates a new table
ALTER TABLE - modifies a table
DROP TABLE - deletes a table
CREATE INDEX - creates an index (search key)
DROP INDEX - deletes an index

Example 2: sql

Structured Query Language

Example 3: sql

Structured Query Language

Example 4: SQL

Let's create a database!

Example 5: SQL

CREATE TABLE friends (
   id INTEGER,
   name TEXT,
   birthday DATE
);

INSERT INTO friends (id, name, birthday) 
VALUES (1, 'Jane Doe', '1990-05-30');


INSERT INTO friends(id , name , birthday)
VALUES(2 , 'APOORV' , '2000-2-2');



UPDATE friends
SET name = 'Jane Srivastava'
WHERE id = 1;

ALTER TABLE friends 
ADD COLUMN email TEXT; 


UPDATE friends 
SET email =  '203029@klsafjls'
where id  = 1; 

UPDATE friends 
SET email =  '203029@klsafjls'
where id  = 2;

DELETE FROM friends 
WHERE id = 1;


SELECT * 
FROM friends;

Example 6: sql

SQL - the standard language to communicate with DBMS.

Example 7: sql

SQL is a domain-specific language used in programming and designed for managing
data held in a relational database management system, or for stream processing
in a relational data stream management system.

Example 8: sql

SELECT * FROM STUDENT

Example 9: sql

SQL is used to communicate with a database.
According to ANSI (American National Standards Institute), it is the standard language for relational database management systems.
SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database.

Example 10: sql

SQL stands for:
Structured Query Language

It's language which enables a user to create,
modify and essentially interact with a database.
As a tester we are usually using Data manipulation
language part of SQL

SQL has 2 parts:
1-DATA MANIPULATION LANGUAGE
It is used to add, retrieve or update the data.
= insert, select, update, delete

2-DATA DEFINITION LANGUAGE
It is used to create database schema and can
be used to define some constraints as well.	
=create, alter, drop, truncate

create table
create window etc.