This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT "column_name1"[, | |
"column_name2" | |
...] | |
FROM "table_name"; | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT cus.FirstName, | |
cus.LastName | |
FROM Customer cus; | |
GO | |
/** Output **/ | |
FirstName LastName | |
---------------------------------------- ---------------------------------------- | |
Paolo Accorti | |
Pedro Afonso |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT "column_name" | |
FROM "table_name" | |
WHERE "condition"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE "table_name" | |
SET "column_1" = [new value] | |
WHERE "condition"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE FROM "table_name" | |
WHERE "condition"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM [ORDER] ord | |
WHERE ord.CustomerId = 85 AND ord.OrderDate = '20131112'; | |
GO | |
/** Output **/ | |
Id OrderDate OrderNumber CustomerId TotalAmount | |
----------- ----------------------- ----------- ----------- --------------------------------------- | |
492 2013-11-12 00:00:00.000 542869 85 240.00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM [ORDER] ord | |
WHERE ord.OrderDate = '20140101' OR ord.OrderDate = '20140130'; | |
GO | |
/** Output **/ | |
Id OrderDate OrderNumber CustomerId TotalAmount | |
----------- ----------------------- ----------- ----------- --------------------------------------- | |
561 2014-01-01 00:00:00.000 542938 55 1660.00 | |
562 2014-01-01 00:00:00.000 542939 88 140.00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM [ORDER] ord | |
WHERE ord.CustomerId IN(85, 14, 1); | |
GO | |
/** Output **/ | |
Id OrderDate OrderNumber CustomerId TotalAmount | |
----------- ----------------------- ----------- ----------- --------------------------------------- | |
1 2012-07-04 00:00:00.000 542378 85 440.00 | |
7 2012-07-11 00:00:00.000 542384 14 625.20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM Customer cus | |
WHERE FirstName LIKE 'Maria'; | |
GO | |
/** Output **/ | |
Id FirstName LastName City Country Phone | |
----------- ---------------------------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- | |
1 Maria Anders Berlin Germany 030-0074321 | |
24 Maria Larsson Bräcke |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM Customer cus | |
WHERE cus.FirstName LIKE 'A%'; --All names that starts with A | |
GO | |
/** Output **/ | |
Id FirstName LastName City Country Phone | |
----------- ---------------------------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- | |
2 Ana Trujillo México D.F. Mexico (5) 555-4729 | |
3 Antonio Moreno México D.F. Mexico (5) 555-3932 |