This file contains hidden or 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
| ```sql | |
| WITH orders AS | |
| (SELECT 5 as order_id, | |
| "sprocket" as item_name, | |
| 200 as quantity) | |
| SELECT * REPLACE ("widget" AS item_name) | |
| FROM orders; | |
| ``` |
This file contains hidden or 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
| ```sql | |
| SELECT DISTINCT regexp_extract("$path", '[^/]+$') AS data_source_file | |
| FROM sampledb.elb_logs | |
| ORDER By data_source_file ASC | |
| ``` |
This file contains hidden or 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
| ```sql | |
| CREATE VIEW vsal | |
| AS | |
| SELECT a.deptno "Department", | |
| a.num_emp / b.total_count "Employees", | |
| a.sal_sum / b.total_sal "Salary" | |
| FROM (SELECT deptno, | |
| Count() num_emp, | |
| SUM(sal) sal_sum | |
| FROM scott.emp |
This file contains hidden or 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
| EXEC Spr_store_note | |
| @NoteId = 0, | |
| @TableTypeId = @TABLE_CUSTOMER, | |
| @RecordId = @CustomerId |
This file contains hidden or 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
| INSERT INTO Production.Location (Name, CostRate, Availability) | |
| VALUES | |
| ( | |
| N'Final Inventory', | |
| 15.00, | |
| 80.00 | |
| ); |
This file contains hidden or 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
| EXEC Sptrackmember @p_member_id,'2.2',@p_weeknum |
This file contains hidden or 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
| DECLARE @s VARCHAR(1000),@s2 VARCHAR(10) |
This file contains hidden or 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
| CREATE PROCEDURE Uspnresults | |
| AS | |
| SELECT Count( contactid ) | |
| FROM person.contact | |
| --begin_no_format | |
| SELECT Count(customerid) FROM sales.customer; | |
| --end_no_format | |
| GO |
This file contains hidden or 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
| DECLARE @find varchar(30); |
This file contains hidden or 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 p.name AS PRODUCT, | |
| p.listprice AS 'LIST PRICE', | |
| p.discount AS 'DISCOUNT' | |
| FROM production.product p | |
| JOIN production.productsubcategory s | |
| ON p.productsubcategoryid = s.productsubcategoryid |