Skip to main content
deleted 28 characters in body
Source Link
Strawberry
  • 34k
  • 3
  • 17
  • 16

Lots of questions about the construction of SQL queries are asked on Stack Overflow every day, each competing for attention with the dozens of others that are asked. Those that take the trouble to provide minimal, reproducible examples are far more likely to be answered quickly, and accurately.

It's easy to provide a sample data set. It doesn't have to be real data. It just has to fairly reflect the nature of the problem at hand.

Similarly for the schema itself; to solve your specific problem, we don't generally need to see the whole thing—and we definitely don't need to see some dull entity relationship diagram, or scrappy screen captures of Excel spreadsheets. Instead, only the relevant tables and a dozen thoughtfully chosen rows of data is usually enough to understand what should be included and/or excluded from a desired result set.

So, it's nice to see three things:

  1. CREATE and INSERT statements (and/or an sqlfiddle or rextester or db-fiddle or db<>fiddle) for all relevant tables, so that we can more easily replicate the problem. Ideally, these should clearly identify PRIMARY/UNIQUE KEYS and incorporate the proper use of data types—so dates are properly formatted (YYYY-MM-DD).

    You can also use anAn ASCII data table generator tool to easily generate formattedcan assist you with the construction of ASCII data tables which you can use in your question. Somesome of the websites mentioned above can then convert those ASCII tables directly into CREATE TABLE and INSERT statements for multiple database systems like MySQL, PostgreSQL or SQL Server (MSSQL).

  2. A desired result set that corresponds with the information provided in step 1.

  3. Your best efforts to date. These don't have to be stellar pieces of cogent analysis. We just like to see that you've taken some steps towards attempting to solve the problem for yourself. It also helps us to know where to start in our explanation.

Lots of questions about the construction of SQL queries are asked on Stack Overflow every day, each competing for attention with the dozens of others that are asked. Those that take the trouble to provide minimal, reproducible examples are far more likely to be answered quickly, and accurately.

It's easy to provide a sample data set. It doesn't have to be real data. It just has to fairly reflect the nature of the problem at hand.

Similarly for the schema itself; to solve your specific problem, we don't generally need to see the whole thing—and we definitely don't need to see some dull entity relationship diagram, or scrappy screen captures of Excel spreadsheets. Instead, only the relevant tables and a dozen thoughtfully chosen rows of data is usually enough to understand what should be included and/or excluded from a desired result set.

So, it's nice to see three things:

  1. CREATE and INSERT statements (and/or an sqlfiddle or rextester or db-fiddle or db<>fiddle) for all relevant tables, so that we can more easily replicate the problem. Ideally, these should clearly identify PRIMARY/UNIQUE KEYS and incorporate the proper use of data types—so dates are properly formatted (YYYY-MM-DD).

    You can also use an ASCII data table generator tool to easily generate formatted ASCII data tables which you can use in your question. Some of the websites mentioned above can convert those ASCII tables directly into CREATE TABLE and INSERT statements for multiple database systems like MySQL, PostgreSQL or SQL Server (MSSQL).

  2. A desired result set that corresponds with the information provided in step 1.

  3. Your best efforts to date. These don't have to be stellar pieces of cogent analysis. We just like to see that you've taken some steps towards attempting to solve the problem for yourself. It also helps us to know where to start in our explanation.

Lots of questions about the construction of SQL queries are asked on Stack Overflow every day, each competing for attention with the dozens of others that are asked. Those that take the trouble to provide minimal, reproducible examples are far more likely to be answered quickly, and accurately.

It's easy to provide a sample data set. It doesn't have to be real data. It just has to fairly reflect the nature of the problem at hand.

Similarly for the schema itself; to solve your specific problem, we don't generally need to see the whole thing—and we definitely don't need to see some dull entity relationship diagram, or scrappy screen captures of Excel spreadsheets. Instead, only the relevant tables and a dozen thoughtfully chosen rows of data is usually enough to understand what should be included and/or excluded from a desired result set.

So, it's nice to see three things:

  1. CREATE and INSERT statements (and/or an sqlfiddle or rextester or db-fiddle or db<>fiddle) for all relevant tables, so that we can more easily replicate the problem. Ideally, these should clearly identify PRIMARY/UNIQUE KEYS and incorporate the proper use of data types—so dates are properly formatted (YYYY-MM-DD).

    An ASCII data table generator tool can assist you with the construction of ASCII data tables which some of the websites mentioned above can then convert directly into CREATE TABLE and INSERT statements for multiple database systems like MySQL, PostgreSQL or SQL Server (MSSQL).

  2. A desired result set that corresponds with the information provided in step 1.

  3. Your best efforts to date. These don't have to be stellar pieces of cogent analysis. We just like to see that you've taken some steps towards attempting to solve the problem for yourself. It also helps us to know where to start in our explanation.

Rollback to Revision 26
Source Link
Strawberry
  • 34k
  • 3
  • 17
  • 16

Lots of questions about the construction of SQL queries are asked on Stack Overflow every day, each competing for attention with the dozens of others that are asked. Those that take the trouble to provide minimal, reproducible examples are far more likely to be answered quickly, and accurately.

It's easy to provide a sample data set. It doesn't have to be real data. It just has to fairly reflect the nature of the problem at hand.

Similarly for the schema itself; to solve your specific problem, we don't generally need to see the whole thing—and we definitely don't need to see some dull entity relationship diagram, or scrappy screen captures of Excel spreadsheets. Instead, only the relevant tables and a dozen thoughtfully chosen rows of data is usually enough to understand what should be included and/or excluded from a desired result set.

So, it's nice to see three things:

  1. CREATE and INSERT statements (and/or an sqlfiddle or rextester or db-fiddle or db<>fiddle) for all relevant tables, so that we can more easily replicate the problem. Ideally, these should clearly identify PRIMARY/UNIQUE KEYS and incorporate the proper use of data types—so dates are properly formatted (YYYY-MM-DD).

    You can also use an ASCII data table generator tool to easily generate formatted ASCII data tables which you can use in your question. Some of the websites mentioned above can convert those ASCII tables directly into CREATE TABLE and INSERT statements for multiple database systems like MySQL, PostgreSQL or SQL Server (MSSQL).

  2. A desired result set that corresponds with the information provided in step 1.

  3. Your best efforts to date. These don't have to be stellar pieces of cogent analysis. We just like to see that you've taken some steps towards attempting to solve the problem for yourself. It also helps us to know where to start in our explanation.

Lots of questions about the construction of SQL queries are asked on Stack Overflow every day, each competing for attention with the dozens of others that are asked. Those that take the trouble to provide minimal, reproducible examples are far more likely to be answered quickly, and accurately.

It's easy to provide a sample data set. It doesn't have to be real data. It just has to fairly reflect the nature of the problem at hand.

Similarly for the schema itself; to solve your specific problem, we don't generally need to see the whole thing—and we definitely don't need to see some dull entity relationship diagram, or scrappy screen captures of Excel spreadsheets. Instead, only the relevant tables and a dozen thoughtfully chosen rows of data is usually enough to understand what should be included and/or excluded from a desired result set.

So, it's nice to see three things:

  1. CREATE and INSERT statements (and/or an sqlfiddle or rextester or db-fiddle or db<>fiddle) for all relevant tables, so that we can more easily replicate the problem. Ideally, these should clearly identify PRIMARY/UNIQUE KEYS and incorporate the proper use of data types—so dates are properly formatted (YYYY-MM-DD).

  2. A desired result set that corresponds with the information provided in step 1.

  3. Your best efforts to date. These don't have to be stellar pieces of cogent analysis. We just like to see that you've taken some steps towards attempting to solve the problem for yourself. It also helps us to know where to start in our explanation.

Lots of questions about the construction of SQL queries are asked on Stack Overflow every day, each competing for attention with the dozens of others that are asked. Those that take the trouble to provide minimal, reproducible examples are far more likely to be answered quickly, and accurately.

It's easy to provide a sample data set. It doesn't have to be real data. It just has to fairly reflect the nature of the problem at hand.

Similarly for the schema itself; to solve your specific problem, we don't generally need to see the whole thing—and we definitely don't need to see some dull entity relationship diagram, or scrappy screen captures of Excel spreadsheets. Instead, only the relevant tables and a dozen thoughtfully chosen rows of data is usually enough to understand what should be included and/or excluded from a desired result set.

So, it's nice to see three things:

  1. CREATE and INSERT statements (and/or an sqlfiddle or rextester or db-fiddle or db<>fiddle) for all relevant tables, so that we can more easily replicate the problem. Ideally, these should clearly identify PRIMARY/UNIQUE KEYS and incorporate the proper use of data types—so dates are properly formatted (YYYY-MM-DD).

    You can also use an ASCII data table generator tool to easily generate formatted ASCII data tables which you can use in your question. Some of the websites mentioned above can convert those ASCII tables directly into CREATE TABLE and INSERT statements for multiple database systems like MySQL, PostgreSQL or SQL Server (MSSQL).

  2. A desired result set that corresponds with the information provided in step 1.

  3. Your best efforts to date. These don't have to be stellar pieces of cogent analysis. We just like to see that you've taken some steps towards attempting to solve the problem for yourself. It also helps us to know where to start in our explanation.

deleted 326 characters in body
Source Link
Strawberry
  • 34k
  • 3
  • 17
  • 16

Lots of questions about the construction of SQL queries are asked on Stack Overflow every day, each competing for attention with the dozens of others that are asked. Those that take the trouble to provide minimal, reproducible examples are far more likely to be answered quickly, and accurately.

It's easy to provide a sample data set. It doesn't have to be real data. It just has to fairly reflect the nature of the problem at hand.

Similarly for the schema itself; to solve your specific problem, we don't generally need to see the whole thing—and we definitely don't need to see some dull entity relationship diagram, or scrappy screen captures of Excel spreadsheets. Instead, only the relevant tables and a dozen thoughtfully chosen rows of data is usually enough to understand what should be included and/or excluded from a desired result set.

So, it's nice to see three things:

  1. CREATE and INSERT statements (and/or an sqlfiddle or rextester or db-fiddle or db<>fiddle) for all relevant tables, so that we can more easily replicate the problem. Ideally, these should clearly identify PRIMARY/UNIQUE KEYS and incorporate the proper use of data types—so dates are properly formatted (YYYY-MM-DD).

    You can also use an ASCII data table generator tool to easily generate formatted ASCII data tables which you can use in your question. Some of the websites mentioned above can convert those ASCII tables directly into CREATE TABLE and INSERT statements for multiple database systems like MySQL, PostgreSQL or SQL Server (MSSQL).

  2. A desired result set that corresponds with the information provided in step 1.

  3. Your best efforts to date. These don't have to be stellar pieces of cogent analysis. We just like to see that you've taken some steps towards attempting to solve the problem for yourself. It also helps us to know where to start in our explanation.

Lots of questions about the construction of SQL queries are asked on Stack Overflow every day, each competing for attention with the dozens of others that are asked. Those that take the trouble to provide minimal, reproducible examples are far more likely to be answered quickly, and accurately.

It's easy to provide a sample data set. It doesn't have to be real data. It just has to fairly reflect the nature of the problem at hand.

Similarly for the schema itself; to solve your specific problem, we don't generally need to see the whole thing—and we definitely don't need to see some dull entity relationship diagram, or scrappy screen captures of Excel spreadsheets. Instead, only the relevant tables and a dozen thoughtfully chosen rows of data is usually enough to understand what should be included and/or excluded from a desired result set.

So, it's nice to see three things:

  1. CREATE and INSERT statements (and/or an sqlfiddle or rextester or db-fiddle or db<>fiddle) for all relevant tables, so that we can more easily replicate the problem. Ideally, these should clearly identify PRIMARY/UNIQUE KEYS and incorporate the proper use of data types—so dates are properly formatted (YYYY-MM-DD).

    You can also use an ASCII data table generator tool to easily generate formatted ASCII data tables which you can use in your question. Some of the websites mentioned above can convert those ASCII tables directly into CREATE TABLE and INSERT statements for multiple database systems like MySQL, PostgreSQL or SQL Server (MSSQL).

  2. A desired result set that corresponds with the information provided in step 1.

  3. Your best efforts to date. These don't have to be stellar pieces of cogent analysis. We just like to see that you've taken some steps towards attempting to solve the problem for yourself. It also helps us to know where to start in our explanation.

Lots of questions about the construction of SQL queries are asked on Stack Overflow every day, each competing for attention with the dozens of others that are asked. Those that take the trouble to provide minimal, reproducible examples are far more likely to be answered quickly, and accurately.

It's easy to provide a sample data set. It doesn't have to be real data. It just has to fairly reflect the nature of the problem at hand.

Similarly for the schema itself; to solve your specific problem, we don't generally need to see the whole thing—and we definitely don't need to see some dull entity relationship diagram, or scrappy screen captures of Excel spreadsheets. Instead, only the relevant tables and a dozen thoughtfully chosen rows of data is usually enough to understand what should be included and/or excluded from a desired result set.

So, it's nice to see three things:

  1. CREATE and INSERT statements (and/or an sqlfiddle or rextester or db-fiddle or db<>fiddle) for all relevant tables, so that we can more easily replicate the problem. Ideally, these should clearly identify PRIMARY/UNIQUE KEYS and incorporate the proper use of data types—so dates are properly formatted (YYYY-MM-DD).

  2. A desired result set that corresponds with the information provided in step 1.

  3. Your best efforts to date. These don't have to be stellar pieces of cogent analysis. We just like to see that you've taken some steps towards attempting to solve the problem for yourself. It also helps us to know where to start in our explanation.

Rollback to Revision 24
Source Link
Strawberry
  • 34k
  • 3
  • 17
  • 16
Loading
Markdown is supported by SO. It is also supported by db-fiddle.
Source Link
Loading
Rollback to Revision 22
Source Link
Heretic Monkey
  • 12.2k
  • 5
  • 50
  • 70
Loading
SO now supports markdown tables
Source Link
Loading
Commonmark migration
Source Link
Loading
added 4 characters in body
Source Link
Strawberry
  • 34k
  • 3
  • 17
  • 16
Loading
added 1 character in body
Source Link
Strawberry
  • 34k
  • 3
  • 17
  • 16
Loading
Rollback to Revision 14
Source Link
Cody Gray Mod
  • 246.2k
  • 85
  • 736
  • 777
Loading
added 40 characters in body
Source Link
Strawberry
  • 34k
  • 3
  • 17
  • 16
Loading
Rollback to Revision 14
Source Link
Cody Gray Mod
  • 246.2k
  • 85
  • 736
  • 777
Loading
deleted 4 characters in body
Source Link
Strawberry
  • 34k
  • 3
  • 17
  • 16
Loading
Rollback to Revision 13
Source Link
Strawberry
  • 34k
  • 3
  • 17
  • 16
Loading
Replace acronym with the newly agreed upon term https://meta.stackoverflow.com/questions/385331/mcvexit-redux-i-dont-need-a-milkshake-to-know-when-ive-missed-the-mark
Source Link
user4639281
user4639281
Loading
added 17 characters in body
Source Link
Cody Gray Mod
  • 246.2k
  • 85
  • 736
  • 777
Loading
added 4 characters in body
Source Link
user3956566
user3956566
Loading
Post Made Community Wiki by user3956566
deleted 2 characters in body
Source Link
Strawberry
  • 34k
  • 3
  • 17
  • 16
Loading
added 226 characters in body
Source Link
Loading
added more fiddle alternatives
Source Link
Madhur Bhaiya
  • 28.9k
  • 12
  • 8
Loading
deleted 12 characters in body
Source Link
Strawberry
  • 34k
  • 3
  • 17
  • 16
Loading
added 12 characters in body
Source Link
ivan_pozdeev
  • 36.7k
  • 3
  • 63
  • 84
Loading
added 23 characters in body
Source Link
Strawberry
  • 34k
  • 3
  • 17
  • 16
Loading