0% found this document useful (0 votes)
19 views

Select Insert Update Delete

The document introduces the four main SQL verbs - SELECT, INSERT, UPDATE, DELETE. It explains that SELECT is used to return rows in response to a query, INSERT adds new rows, UPDATE alters existing rows, and DELETE removes rows. It then provides examples of basic SELECT queries to return column values, calculate statistics like average and standard deviation, and use grouping and aggregation with functions like SUM.

Uploaded by

cocoth5
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Select Insert Update Delete

The document introduces the four main SQL verbs - SELECT, INSERT, UPDATE, DELETE. It explains that SELECT is used to return rows in response to a query, INSERT adds new rows, UPDATE alters existing rows, and DELETE removes rows. It then provides examples of basic SELECT queries to return column values, calculate statistics like average and standard deviation, and use grouping and aggregation with functions like SUM.

Uploaded by

cocoth5
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

To understand, lets begin with the four verbs of SQL,

SELECT, returns rows in response to a query

INSERT, adds new rows to a table

UPDATE, alters existing rows in a table

DELETE, removes rows from a table

SELECT some_columns FROM some_data_source WHERE some_condition;

Data_source refer to tables name.


NAME
SELECT name
FROM nyc_neighborhoods
WHERE boroname = 'Brooklyn';

CHAR_LENGTH
SELECT char_length(name)
FROM nyc_neighborhoods
WHERE boroname = 'Brooklyn';

AVG(), STDEV()
SELECT avg(char_length(name)), stddev(char_length(name))
FROM nyc_neighborhoods
WHERE boroname = 'Brooklyn';

GROUP BY
SELECT boroname, avg(char_length(name)), stddev(char_length(name))
FROM nyc_neighborhoods
GROUP BY boroname;

SUM ()

AS column header name ALIAS

SELECT Sum(popn_total) AS population


FROM nyc_census_blocks;

You might also like