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
CREATE TABLE childstat_reduced AS | |
WITH WT_AVG AS | |
(SELECT AVG(WEIGHT) AS AVG_WT FROM CHILDSTAT | |
) | |
SELECT a.FIRSTNAME, | |
a.GENDER, | |
a.HEIGHT, | |
a.WEIGHT | |
FROM CHILDSTAT a | |
WHERE a.GENDER = 'm' |
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
WITH AVG_WT_GENDER AS | |
(SELECT GENDER,AVG(WEIGHT) AS AVG_WT_SEX FROM CHILDSTAT GROUP BY GENDER | |
), | |
AVG_WT_OVERALL AS | |
(SELECT AVG(AVG_WT_SEX) AS AVG_WT_ALL FROM AVG_WT_GENDER | |
) | |
SELECT a.* | |
FROM CHILDSTAT a | |
WHERE a.WEIGHT >= | |
(SELECT AVG_WT_ALL FROM AVG_WT_OVERALL |
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
CREATE TABLE CANDYBAR_CONSUMPTION_DATA | |
( "SI" NUMBER(*,0), | |
"CONSUMER_ID" NUMBER(*,0), | |
"CANDYBAR_NAME" VARCHAR2(50 BYTE), | |
"SURVEY_YEAR" VARCHAR2(50 BYTE), | |
"GENDER" VARCHAR2(1 BYTE), | |
"OVERALL_RATING" VARCHAR2(2 BYTE), | |
"NUMBER_BARS_CONSUMED" VARCHAR2(50 BYTE) | |
) ; |
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 SURVEY_YEAR, | |
candybar_name, | |
gender, | |
overall_rating, | |
sum(number_bars_consumed) as total_bars_consumed | |
from CANDYBAR_CONSUMPTION_DATA | |
group by grouping sets ( | |
(SURVEY_YEAR,candybar_name,gender,OVERALL_RATING), | |
(SURVEY_YEAR,candybar_name,gender), | |
(SURVEY_YEAR,candybar_name), |
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 SURVEY_YEAR, | |
candybar_name, | |
gender, | |
overall_rating, | |
sum(number_bars_consumed) as total_bars_consumed | |
from CANDYBAR_CONSUMPTION_DATA | |
group by rollup(SURVEY_YEAR,candybar_name,gender,OVERALL_RATING); |
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 SURVEY_YEAR, | |
candybar_name, | |
gender, | |
overall_rating, | |
sum(number_bars_consumed) as total_bars_consumed | |
from candybar_consumption_data | |
group by cube(SURVEY_YEAR,CANDYBAR_NAME,GENDER,OVERALL_RATING) |
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
string[] tags = new string[] { "ruby", "rails", "scruffy", "rubyonrails" }; | |
string cmdText = "SELECT * FROM Tags WHERE Name IN ({0})"; | |
string[] paramNames = tags.Select( | |
(s, i) => "@tag" + i.ToString() | |
).ToArray(); | |
string inClause = string.Join(",", paramNames); | |
using (SqlCommand cmd = new SqlCommand(string.Format(cmdText, inClause))) { | |
for(int i = 0; i < paramNames.Length; i++) { |
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
.itext | |
{ | |
border:1px solid #999; | |
-webkit-border-radius: 3px;-khtml-border-radius:3px;-moz-border-radius:3px;border-radius:3px; | |
margin:0; | |
padding:5px; | |
background: #fff; | |
background: -webkit-gradient(linear, left top, left 25, from(#fff), color-stop(6%, #eee), to(#fff)); | |
background: -moz-linear-gradient(top, #fff, #eee 2px, #fff 25px); | |
box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px; |
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
CREATE TABLE MYRXDATA | |
( | |
DATAKEY DATE, | |
NDC_KEY VARCHAR2(20), | |
COPAY_AMT NUMBER(10,2) | |
); | |
INSERT INTO myrxdata VALUES('01-JAN-05','11111111111',5.12) ; | |
INSERT INTO myrxdata VALUES('01-FEB-05','22222222222',10.24) ; | |
CREATE TABLE DATEDIMENSION( |
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
msiexec /a filepath to MSI file /qb TARGETDIR=filepath to target folder |