Get 2 decimals in my query

  • SELECT 'Per Category' AS Category, 
    [1], [2], [3], [4], [5], [6], [7], [8]
    FROM
    (SELECT CategoryID, AVG(UnitPrice) as UnitPrice
    FROM Products
    GROUP BY CategoryID) AS SourceTable
    PIVOT
    (
    AVG(UnitPrice) FOR CategoryID IN ([1], [2], [3], [4], [5], [6], [7], [8] )
    ) AS PivotTable;

    The results need to look like this:
    Per Category              1           2         3          4         5        6        7          8
    Average Unit Price       37.98    23.06   25.16   28.73   20.25  54.01 32.37   20.68

  • GG_BI_GG - Tuesday, July 24, 2018 12:50 AM

    SELECT 'Per Category' AS Category, 
    [1], [2], [3], [4], [5], [6], [7], [8]
    FROM
    (SELECT CategoryID, AVG(UnitPrice) as UnitPrice
    FROM Products
    GROUP BY CategoryID) AS SourceTable
    PIVOT
    (
    AVG(UnitPrice) FOR CategoryID IN ([1], [2], [3], [4], [5], [6], [7], [8] )
    ) AS PivotTable;

    My  results need to look like this:
    Per Category              1           2         3          4         5        6        7          8
    Average Unit Price       37.98    23.06   25.16   28.73   20.25  54.01 32.37   20.68

    Can you please post the DDL (create table) script, sample data as an insert statement and the expected results?
    😎

  • Product Table look like in the Picture.

  • GG_BI_GG - Tuesday, July 24, 2018 12:58 AM

    Product Table look like in the Picture.

    I think Erikur mentioned clearly what needs to be done .Kindly post at least minimum information to answer your question.

    Saravanan

  • saravanatn - Tuesday, July 24, 2018 2:02 AM

    GG_BI_GG - Tuesday, July 24, 2018 12:58 AM

    Product Table look like in the Picture.

    I think Erikur mentioned clearly what needs to be done .Kindly post at least minimum information to answer your question.

    Have a look at the link in my signature on how to respond Eirikur's request. 🙂

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • GG_BI_GG - Tuesday, July 24, 2018 12:50 AM

    We need to see DDL, and learn what the keys in this table are. What you posted is wrong in so many ways. Your first mistake is the use of what ISO calls "an attribute property"; there is no such thing as a universal magical generic category. Following the laws of identity from elementary logic, a data element would have to be "<something in particular>_category" instead of some absurd number. The next thing is the use of the Microsoft proprietary square brackets should be replaced with the ANSI ISO standard double quote marks. But you shouldn't be using those at all! A column ought to have a proper name, as discussed in ISO 11179 and the metadata committee rules.

    I'm pretty sure I can guess what you're doing. You have confused SQL with a spreadsheet. Spreadsheets use positional numbers on the grid like you're trying to do. In RDBMS we use names. What you should have posted might have look like this

    CREATE TABLE Products
    (product_gtin CHAR(15) NOT NULL PRIMARY KEY,
    product_category CHAR(5) NOT NULL,
    product_unit_price DECIMAL(12,2) NOT NULL
     CHECK(product_unit_price >= 0.00));

    SELECT product_category, AVG(product_unitprice) AS product_unit price_avg
     FROM Products;

    >> The results need to look like this:<<

    No, they don't. You're trying to force a table into a spreadsheet, because that seems to be the only way you understand data. If you want to do that, then you do it in a reporting layer or tier in your architecture.

    Please post DDL and follow ANSI/ISO standards when asking for help. 

  • Dear Mr. Celko,
    Please limit your criticism to that of a constructive nature. Remember us mere mortals can never hope to achieve your familiarity and understanding regarding ISO and ANSI.

    Dear @GG_BI_GG ,
    Without sample data in the form of create table and insert statement(s), what you've tried, what errors or incorrect results you got and what results you want we can only guess the problem and solution.
    Maybe, Cross Tabs and Pivots, Part 1 – Converting Rows to Columns or 
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs could help.

  • DDL will definitely help people to help you. You might want to investigate the FORMAT function which can probably help you get where you're trying to go, eg:

    Select
     Format(3.456,'0.00'),
     Format(0.2,'0.00'),
     Format(0.2,'#.00')

  • jcelko212 32090 - Wednesday, July 25, 2018 11:51 AM

    GG_BI_GG - Tuesday, July 24, 2018 12:50 AM

    We need to see DDL, and learn what the keys in this table are. What you posted is wrong in so many ways. Your first mistake is the use of what ISO calls "an attribute property"; there is no such thing as a universal magical generic category. Following the laws of identity from elementary logic, a data element would have to be "<something in particular>_category" instead of some absurd number. The next thing is the use of the Microsoft proprietary square brackets should be replaced with the ANSI ISO standard double quote marks. But you shouldn't be using those at all! A column ought to have a proper name, as discussed in ISO 11179 and the metadata committee rules.

    I'm pretty sure I can guess what you're doing. You have confused SQL with a spreadsheet. Spreadsheets use positional numbers on the grid like you're trying to do. In RDBMS we use names. What you should have posted might have look like this

    CREATE TABLE Products
    (product_gtin CHAR(15) NOT NULL PRIMARY KEY,
    product_category CHAR(5) NOT NULL,
    product_unit_price DECIMAL(12,2) NOT NULL
     CHECK(product_unit_price >= 0.00));

    SELECT product_category, AVG(product_unitprice) AS product_unit price_avg
     FROM Products;

    >> The results need to look like this:<<

    No, they don't. You're trying to force a table into a spreadsheet, because that seems to be the only way you understand data. If you want to do that, then you do it in a reporting layer or tier in your architecture.

    celko,Why are so rude almost to everybody? Do you know the meaning of forum? In forum people who aspire to learn more are coming frequently than people who knows everything. On another day even Jeff,who is super intelligent says that he doesn't fully ISO standard.He yet to receive a book from you on ISO standard which is very expensive. This people were dominating IT industry if ISO standard is very important they would learned it. This shows they can dominant without ISO.
    I don't know whether your are real celko or some others person pretending to be celko,book author. I don't when is the last time you provided helpful solutions in any forums . I almost follow all sql forums and I found almost useless or same information from you .whether it is old fortran or ISO standard this are two frequent words you used in almost all your recent 1 years post in MSDN forum or Sql Central forum.
    Requesting you to provide new information or information relevant to questions instead of repeating the same things again and again
    or there are fine polite intelligent people  in this forum leave it to them. They will take care of  the questions and provide suitable answers for it

    Saravanan

  • A brief interlude to answer the OP. Remove the aggregate function (AVG) on line 4 of your code. Remove the GROUP BY clause on line 6 of your code and it should run just fine. You are either trying to calculate an average of an average or you don't understand the PIVOT syntax. I'm guessing the latter as I can't think of a real world reason for ever needing the former. Ideally this statement should be inside dynamic SQL so that the number of CategoryIDs can vary dynamically.

    Everyone else: Why do y'all think you need meta data to figure out a two column PIVOT query where you are told one is an ID and the other is an Amount?

    OK, in the spirit of doing things properly I'm going to try ThomA's code tags. Somebody hold my beer.


    SELECT 'Per Category' AS Category, 
    [1], [2], [3], [4], [5], [6], [7], [8] 
    FROM 
    (SELECT CategoryID, UnitPrice as UnitPrice
    FROM Products
    ) AS SourceTable 
    PIVOT 

    AVG(UnitPrice) FOR CategoryID IN ([1], [2], [3], [4], [5], [6], [7], [8] ) 
    ) AS PivotTable; 

    As you were gentlefolk.

  • Thom A, I used to trust you.

  • saravanatn - Wednesday, July 25, 2018 3:32 PM

    jcelko212 32090 - Wednesday, July 25, 2018 11:51 AM

    GG_BI_GG - Tuesday, July 24, 2018 12:50 AM

    We need to see DDL, and learn what the keys in this table are. What you posted is wrong in so many ways. Your first mistake is the use of what ISO calls "an attribute property"; there is no such thing as a universal magical generic category. Following the laws of identity from elementary logic, a data element would have to be "<something in particular>_category" instead of some absurd number. The next thing is the use of the Microsoft proprietary square brackets should be replaced with the ANSI ISO standard double quote marks. But you shouldn't be using those at all! A column ought to have a proper name, as discussed in ISO 11179 and the metadata committee rules.

    I'm pretty sure I can guess what you're doing. You have confused SQL with a spreadsheet. Spreadsheets use positional numbers on the grid like you're trying to do. In RDBMS we use names. What you should have posted might have look like this

    CREATE TABLE Products
    (product_gtin CHAR(15) NOT NULL PRIMARY KEY,
    product_category CHAR(5) NOT NULL,
    product_unit_price DECIMAL(12,2) NOT NULL
     CHECK(product_unit_price >= 0.00));

    SELECT product_category, AVG(product_unitprice) AS product_unit price_avg
     FROM Products;

    >> The results need to look like this:<<

    No, they don't. You're trying to force a table into a spreadsheet, because that seems to be the only way you understand data. If you want to do that, then you do it in a reporting layer or tier in your architecture.

    celko,Why are so rude almost to everybody? Do you know the meaning of forum? In forum people who aspire to learn more are coming frequently than people who knows everything. On another day even Jeff,who is super intelligent says that he doesn't fully ISO standard.He yet to receive a book from you on ISO standard which is very expensive. This people were dominating IT industry if ISO standard is very important they would learned it. This shows they can dominant without ISO.
    I don't know whether your are real celko or some others person pretending to be celko,book author. I don't when is the last time you provided helpful solutions in any forums . I almost follow all sql forums and I found almost useless or same information from you .whether it is old fortran or ISO standard this are two frequent words you used in almost all your recent 1 years post in MSDN forum or Sql Central forum.
    Requesting you to provide new information or information relevant to questions instead of repeating the same things again and again
    or there are fine polite intelligent people  in this forum leave it to them. They will take care of  the questions and provide suitable answers for it

    >> Celko,Why are so rude almost to everybody? <<

    When have I ever failed to post DDL and give explanations that refer to standards or best practices? Not posting DDL and vague useless specs, is what is rude.

    >> On another day even Jeff,who is super intelligent says that he doesn't fully ISO standard .He yet to receive a book from you on ISO standard which is very expensive. <<

    Why don't you send Jeff a few thousand dollars worth of ISO standards? He's never even sent me a Christmas card. Why don't you send Jeff a few thousand dollars worth of ISO standards? He's never even sent me a Christmas card. :-(:crying:

    And for what it's worth, the way I learned to read ISO standards was by spending 10 years on the standards committee. There are politics, specialized vocabulary, the whole world in itself. It's very much like being a lawyer; the people who haven't put in the work have to depend on those of us who have.

    >> This people were dominating IT industry if ISO standard is very important they would learned it. This shows they can dominant without ISO. <<

    Actually, you don't realize it, but just the fact you are writing SQL means that you depend on industry standards. Do you also write and other standardized programming languages? Probably.

    But I do more than just push the standards. I'm also a fanatic about proper design and best practices. Before I became "the SQL guy" I was one of the early writers on software engineering and had regular columns in the trade press. I also taught classes commercially. The basic principles still apply, after 35 years.

    >> ..whether it is old Fortran or ISO standard this are two frequent words you used in almost all your recent 1 years post in MSDN forum or SQL Central forum. <<

    I'm sorry you feel that ISO standards are not relevant in the IT trade. I've reference them to show that I don't post my opinions, or proprietary vendor tricks, but preferred industry standards.Are you also opposed to the metric system? USB specs? 🙂

    >> Requesting you to provide new information or information relevant to questions instead of repeating the same things again and again ..<<

    Have you noticed that people ask the same questions over and over? Why should the answers change? If someone ask about the Pythagorean theorem on a math forum, what different answers should they get? What I've started doing is posting links to some of the ~1500 articles I've written over the last 30+ years, rather than try to duplicate it, printing again and again.

    However, I have the feeling that a lot of posters on forums don't want to learn anything; they want somebody else to do their homework or their job for them.

    Did you notice that in this posting. I didn't just give the guy a standard way of doing it (a normalized table DDL, a short explanation of how normal forms work, quick sample data). I've been teaching SQL and relational database for decades and one of the things I've noticed that people make classic errors. This is one common example. Learning RDBMS and SQL is like learning any other foreign language. When you are new to the language, you use the rules that you learned from your original language. Chinese tend to speak English in the present tense only. Germans tend to put the verb at the end of the sentence. Many Asians don't understand plurals. English speakers don't understand grammatical genders. Etc. Until you realize that your new language is either missing something or has an extra something you did not expect, you're always going to sound like a foreigner and do it wrong.

    You don't have the experience in teaching RDBMS, so you cannot see that he is treating this as if it's a spreadsheet. You apparently also don't know what a key is and why it's required, nor any understanding of basic normal forms. So instead of doing it right, you just go ahead and kludge it.

    Encouraging new programmers to write bad code is not a good idea. You need to catch them early, explain what they're doing wrong and give them some corrections. Frankly, you're coming off as a whiny little snowflake!

    Please post DDL and follow ANSI/ISO standards when asking for help. 

  • emcardle01 - Wednesday, July 25, 2018 4:37 PM

    A brief interlude to answer the OP. Remove the aggregate function (AVG) on line 4 of your code. Remove the GROUP BY clause on line 6 of your code and it should run just fine. You are either trying to calculate an average of an average or you don't understand the PIVOT syntax. I'm guessing the latter as I can't think of a real world reason for ever needing the former. Ideally this statement should be inside dynamic SQL so that the number of CategoryIDs can vary dynamically.

    Everyone else: Why do y'all think you need meta data to figure out a two column PIVOT query where you are told one is an ID and the other is an Amount?

    OK, in the spirit of doing things properly I'm going to try ThomA's code tags. Somebody hold my beer.


    SELECT 'Per Category' AS Category, 
    [1], [2], [3], [4], [5], [6], [7], [8] 
    FROM 
    (SELECT CategoryID, UnitPrice as UnitPrice
    FROM Products
    ) AS SourceTable 
    PIVOT 

    AVG(UnitPrice) FOR CategoryID IN ([1], [2], [3], [4], [5], [6], [7], [8] ) 
    ) AS PivotTable; 

    As you were gentlefolk.

    Why do we ask for DDL, sample data, expected results?  For one, as volunteers we don't always have the time to create these in an effort to answer an OPs question.  Second, the OP is the one asking the question and should be able to provide enough information that can ensure everyone is on the same page as the OP.  Remember, we can't see what they see.  If we create what is asked, it may not meet the requirements of the OP regardless of how simple if may appear.  Plus, many times a simple question is asked and answered only to find out it wasn't the complete question.  Third, having all these things in a readily consumable format makes it easier for us to set up a sandbox environment and provides something to test to allowing us to actually provide tested code.

  • jcelko212 32090 - Friday, July 27, 2018 1:22 PM

    saravanatn - Wednesday, July 25, 2018 3:32 PM

    jcelko212 32090 - Wednesday, July 25, 2018 11:51 AM

    GG_BI_GG - Tuesday, July 24, 2018 12:50 AM

    We need to see DDL, and learn what the keys in this table are. What you posted is wrong in so many ways. Your first mistake is the use of what ISO calls "an attribute property"; there is no such thing as a universal magical generic category. Following the laws of identity from elementary logic, a data element would have to be "<something in particular>_category" instead of some absurd number. The next thing is the use of the Microsoft proprietary square brackets should be replaced with the ANSI ISO standard double quote marks. But you shouldn't be using those at all! A column ought to have a proper name, as discussed in ISO 11179 and the metadata committee rules.

    I'm pretty sure I can guess what you're doing. You have confused SQL with a spreadsheet. Spreadsheets use positional numbers on the grid like you're trying to do. In RDBMS we use names. What you should have posted might have look like this

    CREATE TABLE Products
    (product_gtin CHAR(15) NOT NULL PRIMARY KEY,
    product_category CHAR(5) NOT NULL,
    product_unit_price DECIMAL(12,2) NOT NULL
     CHECK(product_unit_price >= 0.00));

    SELECT product_category, AVG(product_unitprice) AS product_unit price_avg
     FROM Products;

    >> The results need to look like this:<<

    No, they don't. You're trying to force a table into a spreadsheet, because that seems to be the only way you understand data. If you want to do that, then you do it in a reporting layer or tier in your architecture.

    celko,Why are so rude almost to everybody? Do you know the meaning of forum? In forum people who aspire to learn more are coming frequently than people who knows everything. On another day even Jeff,who is super intelligent says that he doesn't fully ISO standard.He yet to receive a book from you on ISO standard which is very expensive. This people were dominating IT industry if ISO standard is very important they would learned it. This shows they can dominant without ISO.
    I don't know whether your are real celko or some others person pretending to be celko,book author. I don't when is the last time you provided helpful solutions in any forums . I almost follow all sql forums and I found almost useless or same information from you .whether it is old fortran or ISO standard this are two frequent words you used in almost all your recent 1 years post in MSDN forum or Sql Central forum.
    Requesting you to provide new information or information relevant to questions instead of repeating the same things again and again
    or there are fine polite intelligent people  in this forum leave it to them. They will take care of  the questions and provide suitable answers for it

    >> Celko,Why are so rude almost to everybody? <<

    When have I ever failed to post DDL and give explanations that refer to standards or best practices? Not posting DDL and vague useless specs, is what is rude.

    >> On another day even Jeff,who is super intelligent says that he doesn't fully ISO standard .He yet to receive a book from you on ISO standard which is very expensive. <<

    Why don't you send Jeff a few thousand dollars worth of ISO standards? He's never even sent me a Christmas card. Why don't you send Jeff a few thousand dollars worth of ISO standards? He's never even sent me a Christmas card. :-(:crying:

    And for what it's worth, the way I learned to read ISO standards was by spending 10 years on the standards committee. There are politics, specialized vocabulary, the whole world in itself. It's very much like being a lawyer; the people who haven't put in the work have to depend on those of us who have.

    >> This people were dominating IT industry if ISO standard is very important they would learned it. This shows they can dominant without ISO. <<

    Actually, you don't realize it, but just the fact you are writing SQL means that you depend on industry standards. Do you also write and other standardized programming languages? Probably.

    But I do more than just push the standards. I'm also a fanatic about proper design and best practices. Before I became "the SQL guy" I was one of the early writers on software engineering and had regular columns in the trade press. I also taught classes commercially. The basic principles still apply, after 35 years.

    >> ..whether it is old Fortran or ISO standard this are two frequent words you used in almost all your recent 1 years post in MSDN forum or SQL Central forum. <<

    I'm sorry you feel that ISO standards are not relevant in the IT trade. I've reference them to show that I don't post my opinions, or proprietary vendor tricks, but preferred industry standards.Are you also opposed to the metric system? USB specs? 🙂

    >> Requesting you to provide new information or information relevant to questions instead of repeating the same things again and again ..<<

    Have you noticed that people ask the same questions over and over? Why should the answers change? If someone ask about the Pythagorean theorem on a math forum, what different answers should they get? What I've started doing is posting links to some of the ~1500 articles I've written over the last 30+ years, rather than try to duplicate it, printing again and again.

    However, I have the feeling that a lot of posters on forums don't want to learn anything; they want somebody else to do their homework or their job for them.

    Did you notice that in this posting. I didn't just give the guy a standard way of doing it (a normalized table DDL, a short explanation of how normal forms work, quick sample data). I've been teaching SQL and relational database for decades and one of the things I've noticed that people make classic errors. This is one common example. Learning RDBMS and SQL is like learning any other foreign language. When you are new to the language, you use the rules that you learned from your original language. Chinese tend to speak English in the present tense only. Germans tend to put the verb at the end of the sentence. Many Asians don't understand plurals. English speakers don't understand grammatical genders. Etc. Until you realize that your new language is either missing something or has an extra something you did not expect, you're always going to sound like a foreigner and do it wrong.

    You don't have the experience in teaching RDBMS, so you cannot see that he is treating this as if it's a spreadsheet. You apparently also don't know what a key is and why it's required, nor any understanding of basic normal forms. So instead of doing it right, you just go ahead and kludge it.

    Encouraging new programmers to write bad code is not a good idea. You need to catch them early, explain what they're doing wrong and give them some corrections. Frankly, you're coming off as a whiny little snowflake!

    Joe, Joe, Joe.  We aren't encouraging new programmers to write bad code.  We also don't degrade them because they are learning and don't always use the correct terms (row vs record, column vs field as simple examples).  We can work it because some of us have been around as long as you but aren't as cynical or critical as you.  We have learned that people actually learn better when treated with respect and understanding instead of beat over the head all the time.

    You keep telling everyone to follow the ISO Standards, but unfortunately, many companies won't pay for them so their developers can have them to follow nor are many of us going to fork out the money from our own pocket to pay for them either since they do keep changing over time.

    Also, Jeff asked what standard you were talking about regarding dates in another thread, and even post the relevant part of it only to have you disappear and not answer him.  I get it, you don't like it when you get called out.  And Yes I have called you when code you posted in several threads failed to work.  If you are going to post code, you should at least verify that it will run.  That means in SQL Server when you post here.

  • jcelko212 32090 - Friday, July 27, 2018 1:22 PM

    saravanatn - Wednesday, July 25, 2018 3:32 PM

    jcelko212 32090 - Wednesday, July 25, 2018 11:51 AM

    GG_BI_GG - Tuesday, July 24, 2018 12:50 AM

    We need to see DDL, and learn what the keys in this table are. What you posted is wrong in so many ways. Your first mistake is the use of what ISO calls "an attribute property"; there is no such thing as a universal magical generic category. Following the laws of identity from elementary logic, a data element would have to be "<something in particular>_category" instead of some absurd number. The next thing is the use of the Microsoft proprietary square brackets should be replaced with the ANSI ISO standard double quote marks. But you shouldn't be using those at all! A column ought to have a proper name, as discussed in ISO 11179 and the metadata committee rules.

    I'm pretty sure I can guess what you're doing. You have confused SQL with a spreadsheet. Spreadsheets use positional numbers on the grid like you're trying to do. In RDBMS we use names. What you should have posted might have look like this

    CREATE TABLE Products
    (product_gtin CHAR(15) NOT NULL PRIMARY KEY,
    product_category CHAR(5) NOT NULL,
    product_unit_price DECIMAL(12,2) NOT NULL
     CHECK(product_unit_price >= 0.00));

    SELECT product_category, AVG(product_unitprice) AS product_unit price_avg
     FROM Products;

    >> The results need to look like this:<<

    No, they don't. You're trying to force a table into a spreadsheet, because that seems to be the only way you understand data. If you want to do that, then you do it in a reporting layer or tier in your architecture.

    celko,Why are so rude almost to everybody? Do you know the meaning of forum? In forum people who aspire to learn more are coming frequently than people who knows everything. On another day even Jeff,who is super intelligent says that he doesn't fully ISO standard.He yet to receive a book from you on ISO standard which is very expensive. This people were dominating IT industry if ISO standard is very important they would learned it. This shows they can dominant without ISO.
    I don't know whether your are real celko or some others person pretending to be celko,book author. I don't when is the last time you provided helpful solutions in any forums . I almost follow all sql forums and I found almost useless or same information from you .whether it is old fortran or ISO standard this are two frequent words you used in almost all your recent 1 years post in MSDN forum or Sql Central forum.
    Requesting you to provide new information or information relevant to questions instead of repeating the same things again and again
    or there are fine polite intelligent people  in this forum leave it to them. They will take care of  the questions and provide suitable answers for it

    >> Celko,Why are so rude almost to everybody? <<

    When have I ever failed to post DDL and give explanations that refer to standards or best practices? Not posting DDL and vague useless specs, is what is rude.

    >> On another day even Jeff,who is super intelligent says that he doesn't fully ISO standard .He yet to receive a book from you on ISO standard which is very expensive. <<

    Why don't you send Jeff a few thousand dollars worth of ISO standards? He's never even sent me a Christmas card. Why don't you send Jeff a few thousand dollars worth of ISO standards? He's never even sent me a Christmas card. :-(:crying:

    And for what it's worth, the way I learned to read ISO standards was by spending 10 years on the standards committee. There are politics, specialized vocabulary, the whole world in itself. It's very much like being a lawyer; the people who haven't put in the work have to depend on those of us who have.

    >> This people were dominating IT industry if ISO standard is very important they would learned it. This shows they can dominant without ISO. <<

    Actually, you don't realize it, but just the fact you are writing SQL means that you depend on industry standards. Do you also write and other standardized programming languages? Probably.

    But I do more than just push the standards. I'm also a fanatic about proper design and best practices. Before I became "the SQL guy" I was one of the early writers on software engineering and had regular columns in the trade press. I also taught classes commercially. The basic principles still apply, after 35 years.

    >> ..whether it is old Fortran or ISO standard this are two frequent words you used in almost all your recent 1 years post in MSDN forum or SQL Central forum. <<

    I'm sorry you feel that ISO standards are not relevant in the IT trade. I've reference them to show that I don't post my opinions, or proprietary vendor tricks, but preferred industry standards.Are you also opposed to the metric system? USB specs? 🙂

    >> Requesting you to provide new information or information relevant to questions instead of repeating the same things again and again ..<<

    Have you noticed that people ask the same questions over and over? Why should the answers change? If someone ask about the Pythagorean theorem on a math forum, what different answers should they get? What I've started doing is posting links to some of the ~1500 articles I've written over the last 30+ years, rather than try to duplicate it, printing again and again.

    However, I have the feeling that a lot of posters on forums don't want to learn anything; they want somebody else to do their homework or their job for them.

    Did you notice that in this posting. I didn't just give the guy a standard way of doing it (a normalized table DDL, a short explanation of how normal forms work, quick sample data). I've been teaching SQL and relational database for decades and one of the things I've noticed that people make classic errors. This is one common example. Learning RDBMS and SQL is like learning any other foreign language. When you are new to the language, you use the rules that you learned from your original language. Chinese tend to speak English in the present tense only. Germans tend to put the verb at the end of the sentence. Many Asians don't understand plurals. English speakers don't understand grammatical genders. Etc. Until you realize that your new language is either missing something or has an extra something you did not expect, you're always going to sound like a foreigner and do it wrong.

    You don't have the experience in teaching RDBMS, so you cannot see that he is treating this as if it's a spreadsheet. You apparently also don't know what a key is and why it's required, nor any understanding of basic normal forms. So instead of doing it right, you just go ahead and kludge it.

    Encouraging new programmers to write bad code is not a good idea. You need to catch them early, explain what they're doing wrong and give them some corrections. Frankly, you're coming off as a whiny little snowflake!

    Even I find this post as irrelevant.I think you don't understanding of educational system around the world and how people will be. I think we can't compare the educational system of India with Japan or Germany or any other country for that matter.
    For example in India many people study degrees like mechanical or electronics engineering where there is no programming language or database concepts included in curriculum. Then they won't get jobs in their respective core field. They move into I.T industry.
    Some of them don't study in english medium they study in Tamil medium. They entered into I.T corporates and training provided is also average.
    They were put into project straight away.  They want some reliable guidance to learn things properly and that's why they turn to forums.
    You insulted people posting home work in forum. Now the same people were writing complex coding  for end to end systems and getting appreciated by clients they were working in .  I personally know many people like that .So don't under estimate anyone.
    I am politely saying this I would ignore all your posts in future as it sounds irrelevant to me 
    And won't reply if you reply back to this post . So don't bother reply to me.

    Saravanan

Viewing 15 posts - 1 through 15 (of 22 total)

You must be logged in to reply to this topic. Login to reply