Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
24 views

SQL Select Syntax: AND Operator Example

The document summarizes common SQL syntax for selecting, inserting, updating, deleting, and filtering data in database tables. It explains that SELECT statements retrieve data, INSERT statements add new rows, UPDATE changes existing rows, and DELETE removes rows. WHERE clauses and operators like AND and OR are used to filter results by column values. DISTINCT can be used with SELECT to eliminate duplicate rows from query results.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

SQL Select Syntax: AND Operator Example

The document summarizes common SQL syntax for selecting, inserting, updating, deleting, and filtering data in database tables. It explains that SELECT statements retrieve data, INSERT statements add new rows, UPDATE changes existing rows, and DELETE removes rows. WHERE clauses and operators like AND and OR are used to filter results by column values. DISTINCT can be used with SELECT to eliminate duplicate rows from query results.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL SELECT Syntax

SELECT column_name(s) FROM table_name


and

SELECT * FROM table_name

SQL INSERT INTO Syntax


It is possible to write the INSERT INTO statement in two forms. The first form doesn't specify the column names where the data will be inserted, only their values:

INSERT INTO table_name VALUES (value1, value2, value3,...)


The second form specifies both the column names and the values to be inserted:

INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)

SQL UPDATE Syntax


UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value

SQL DELETE Syntax


DELETE FROM table_name WHERE some_column=some_value

SQL WHERE Syntax


SELECT column_name(s) FROM table_name WHERE column_name operator value

AND Operator Example


SELECT * FROM Persons WHERE FirstName='Tove' AND LastName='Svendson'

OR Operator Example
SELECT * FROM Persons WHERE FirstName='Tove' OR FirstName='Ola'

combining AND & OR


SELECT * FROM Persons WHERE
LastName='Svendson' AND (FirstName='Tove' OR FirstName='Ola')

SQL DISTINCT COMMAND SELECT DISTINCT "column_name" FROM "table_name"

You might also like