Forum Replies Created

Viewing 15 posts - 2,101 through 2,115 (of 7,613 total)

  • Reply To: Practice SQL querying with dates and aggregations

    Jeff Moden wrote:

    ScottPletcher wrote:

    Jeff Moden wrote:

    ScottPletcher wrote:

    I provide the table structure, that's it. They are in SSMS session, so they can use whatever SSMS tools there are to view that structure.

    Ah... therein...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Practice SQL querying with dates and aggregations

    The "trick" part of the query is determining the middle score.  Many developers don't figure that one out.

    In my own way I tried to help (sort of), since you can...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Practice SQL querying with dates and aggregations

    Jeff Moden wrote:

    ScottPletcher wrote:

    I provide the table structure, that's it. They are in SSMS session, so they can use whatever SSMS tools there are to view that structure.

    Ah... therein lies the...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Practice SQL querying with dates and aggregations

    jcelko212 32090 wrote:

    >> would hate having to be the DBA going to a place that Celko had designed / created. What a nightmare of missing leading zeros or added leading zeros...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Practice SQL querying with dates and aggregations

    Here's another q I like to use:

    "Bad data is getting into a prod table from an app.  Developers have full data modification authority to that data and currently fix it...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Practice SQL querying with dates and aggregations

    Lord Slaagh wrote:

    Scott - If you are not looking for the test results to be listed in a string, then I think this is what you are looking for.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Practice SQL querying with dates and aggregations

    Jeff Moden wrote:

    jcelko212 32090 wrote:

    But, by definition, an identifier is on a nominal scale and nominal scales are never numeric.

    That's really a mistake on your part to think so in...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Practice SQL querying with dates and aggregations

    Jeff Moden wrote:

    ScottPletcher wrote:

    This is the main test q I use to test query-writing skill.  It's not as trivial / obvious as it sounds at first.

    A table contains 1, 2 or...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Practice SQL querying with dates and aggregations

    As a drastic example of what I've talking about, say you asked an applicant to list all the columns from the table.  Say the table has key_col, data_col1, data_col2.  No...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Practice SQL querying with dates and aggregations

    Lord Slaagh wrote:

    Scott - I agree with Jeff in the sense that this test is somewhat unrealistic because you have CTE's and sub queries at your disposal. However, if this is...

    • This reply was modified 5 years, 7 months ago by ScottPletcher.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Join to lookup table on multiple columns

    Jeffrey Williams wrote:

    Except that single outer apply will be executed for each row in the Meter table - and the data must be sorted each time based on the filters from...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Practice SQL querying with dates and aggregations

    Pretty good overall, reasonably close.

    But:

    the middle score will not necessarily be the avg score (sum/count is same as avg);

    if there are fewer than 3 scores, leave extra scores NULL.  For...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Join to lookup table on multiple columns

    Jeffrey Williams wrote:

    Just curious - but how are these solutions better than using multiple joins?  If this is a performance related issue - fix the use of the upper functions on...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Practice SQL querying with dates and aggregations

    Here's the table structure:

    student_scores ( student_id int NOT NULL, assignment_number int NOT NULL, score int NOT NULL )

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: How to know which index is invalid index on a table?

    Typically, you'd want columns used in the WHERE condition to be in the index keys, for the reasons noted by Mr. Gale.

    select *from SaleOrderLines where OrderID='value1' and itemid=value2' and status='open'

    However,...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Viewing 15 posts - 2,101 through 2,115 (of 7,613 total)