0% found this document useful (0 votes)
6 views5 pages

Class Notes

Uploaded by

iiyearcsegirls
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Class Notes

Uploaded by

iiyearcsegirls
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

16-03-2026

DATA ANALYTICS
collecting data - cleaning data - analysing data - forming insights

PYTHON
optional - R
SQL
POWERBI
TABLEAU
EXCEL

SQL - STRUCTURED QUERY LANGUAGE


it is a language used to communicate with data in a database inside server

when you have a server - you can host your application


when you have a server - you can create a database
when you have a database - you can create tables

to create a database:
CREATE DATABASE myinstadb;

to create a table:
CREATE TABLE users
(id int,
name varchar,
dob int,
phone int,
email varchar);

to insert data into the table


INSERT INTO users VALUES (101,'sathya',05-11-2005,1234,'sathya@[Link]');

DATA MANIPULATION - editing/modifying data


UPDATE AND DELETE

format:
UPDATE tbname
SET colname = value
WHERE condition;

Alfreds belongs to city London and not Berlin


UPDATE Customers
SET City = "London"
WHERE CustomerName = "Alfreds Futterkiste";

delete entire John data


DELETE FROM Customers WHERE first_name = "John";

DATA QUERY LANGUAGE: SELECT


select * from tablemname;
SELECT * FROM tablename where rownum<10;
SELECT * FROM tablename limit 10;

SELECT CustomerName, City FROM Customers;


SELECT Country FROM Customers WHERE CustomerID = 50;

ASSIGNMENT 1 - use Programiz database for the below questions


Customers Table
1. John comes from Australia and not USA
2. People who are from USA belongs to age category 40
3. Betty's last name is Rancho grande

Orders Table
1. Keyboard cost has increased to 800
2. Customer 2 has purchased mousepad for 500
3. Order Mouse has been renamed to Dell_Mouse

WILDCARDS
it is used for pattern based searching
we will use an operator called LIKE

SELECT * FROM Customers where ContactName LIKE 'C%';


SELECT * FROM Customers where ContactName LIKE '%C';
SELECT * FROM Customers where ContactName LIKE '%es%';

% - denotes one or more characters


_ - denotes only one character

SELECT * FROM Customers where ContactName LIKE 'c%a';

[]
!
*
-

LIKE [asp];
LIKE [!asp]
LIKE [c-i]

Display details of customerid 1,56,45,25

SELECT * FROM Customers WHERE CustomerID in (1,56,45,25);

= accepts only one value


in accepts more than one value

SELECT * FROM Customers WHERE CustomerID=1 or CustomerID=56 or


CustomerID=45 or CustomerID=25;

Customer ID 1 to 10 - between and

Select * from Customers where CustomerID between 1 and 10;

Aggregate Functions : sum(),min(),max(),avg(),count()

SELECT sum(Price) from Products;


ASSIGNMENT 2
1. What is the contact number of Shipper Speedy Express ? (Shippers Table)
2. What is the price of Grandma's Boysenberry Spread? (Products Table)
3. Do you have a product called Chai? (Products Table)
4. How many unit of Schoggi Schokolade is available? (Products Table)
5. What products does supplierid 12 take care of? (Products Table)
6. Give me Fuller's detail. (Employees Table)
7. What products do we have in Beverages? (Category Table)
8. What is the categoryID of Meat/Poultry? (Category Table)
9. Display the city of contact names starting with C. (Customer Table)
10. A country that starts with letter S has how many customers? (Customer
Table)

CONSTRAINTS - rules
PRIMARY KEY
FOREIGN KEY
NOT NULL KEY
CHECK KEY
UNIQUE KEY

Joins
combining two or more tables
one commonly used type of joins - SELF JOIN

Find customers and their order details


1. which tables are involved : Customers and Orders
2. common field : CustomerID
3. what data to fetch :
CustomerName,City
OrderID, OrderDate

SELECT [Link],[Link],[Link],[Link]
FROM Customers c,Orders o
WHERE [Link] = [Link];
if three tables

WHERE
[Link] = [Link]
or
[Link] = [Link];

Order By - sort the result-set in ascending or descending order.

SELECT * FROM Products


ORDERBY Price;

SELECT * FROM Products


ORDERBY Price DSC;

SELECT * FROM Customers


ORDERBY Country, CustomerName;

SELECT * FROM Customers


ORDERBY Country ASEC, CustomerName DESC;

You might also like