0% found this document useful (0 votes)
3 views12 pages

SQL Guide: Importing CSV & Queries

The document provides a guide on importing CSV files into SQL, using the Table Data Import Wizard. It covers key SQL concepts such as the WHERE clause for filtering records, various operators for conditions, aggregate functions for data analysis, and commands for deleting, truncating, and altering tables. Additionally, it explains how to limit query results and includes a note for further queries.

Uploaded by

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

SQL Guide: Importing CSV & Queries

The document provides a guide on importing CSV files into SQL, using the Table Data Import Wizard. It covers key SQL concepts such as the WHERE clause for filtering records, various operators for conditions, aggregate functions for data analysis, and commands for deleting, truncating, and altering tables. Additionally, it explains how to limit query results and includes a note for further queries.

Uploaded by

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

SQL

Dnyanesh Sarode
Importing csv to SQL

Right click on table


Table data import wizard
Select the file from Location
Select as a new table
Where Clause
The WHERE clause is used to filter records.
It is used to extract only those records that fulfill a specified condition.
Operators
• Comparison Operators:
• Equal to: =
• Not equal to: <>
• Greater than: >
• Less than: <
• Greater than or equal to: >=
• Less than or equal to: <=
• AND: Used to combine multiple conditions, all of which must be
true.
• OR: Used to combine multiple conditions, at least one of which
must be true.
Pattern should be in single quote

Showing Null
Position

Showing Non
Null Values
Aggregate Functions

• SELECT COUNT(column_name) To Check the number of rows,


FROM table_name SELECT count(*) from table_name;
WHERE condition;

• SELECT AVG(column_name)
FROM table_name
WHERE condition;

• SELECT SUM(column_name)
FROM table_name
WHERE condition;
Unique Values
• SELECT DISTINCT column1, column2, ...
FROM table_name;
Delete / Truncate / Drop
• DELETE FROM table_name WHERE condition;

• TRUNCATE TABLE table_name;

• DROP TABLE table_name;


Alter Table
• ALTER TABLE table_name ADD COLUMN column_name data_type;

• ALTER TABLE table_name MODIFY COLUMN column_name


new_data_type;

• ALTER TABLE table_name DROP COLUMN column_name;


Update-set
• UPDATE employees SET salary = 5000, first_name = 'John'
WHERE employee_id = 123;

SET SQL_SAFE_UPDATES = 0;
Limit
• SELECT * FROM table_name LIMIT 5; First 5 Rows

• SELECT * FROM table_name LIMIT 6,1; Skipped 5 Rows then select 2


Thank You
If you have any query, You can ask

You might also like