SQLServerCentral Editorial

Please include your DDL

,

I haven’t done it much the past few years, but I would answer some programming questions posted in forums back in the day. In the late 90s, I answered Visual Basic questions and eventually switched to SQL Server questions here on SQL Server Central as my career progressed. Answering questions not only assisted someone else, but it also helped me learn as well.

Now, because I’m learning more about MySQL, I’m trying to answer a MySQL question every day on Stack Overflow. Like many tech professionals, I frequently find answers to my own questions on the site, but this is the first time I’ve tried answering any.

In my case, I’m seeing syntax in the MySQL code that looks unfamiliar to my brain that's so used to T-SQL. For example, I would write and call a proc selecting the rows from a table called Airplanes like this:

CREATE PROC usp_getPlanes AS
    SELECT ID, Name, Description
    FROM airplanes;
GO
EXEC dbo.usp_getPlanes;

The same procedure in MySQL looks like this:

DELIMITER //
CREATE PROCEDURE getPlanes() 
BEGIN 
    SELECT ID, Name, Description 
    FROM airplanes; 
END//
DELIMITER ;
CALL getPlanes();

As I run across these differences, I can learn more about MySQL syntax and possibly answer the questions. I might also get some ideas for Simple Talk or SQL Server Central articles.

Spending some time looking at MySQL questions on Stack Overflow seems useful but has been somewhat frustrating. The questions are grabbed up quickly, probably due to the vast audience on the site, but I wonder if some folks watch for new questions several hours each day to gain reputation points. It’s very competitive.

Many rude comments are not helpful at all. Instead, they are “this question was answered by another post” or “read the manual.” I like to give the poster the benefit of the doubt and assume that they did try searching for their answer and couldn’t find it. Sometimes the linked post that is supposed to have the solution doesn't.

The biggest problem with answering query questions is that it is rare to see the DDL and DML statements given, but I don't think that's limited to Stack Overflow. Some questions will show some sample data and maybe what the data returned is supposed to look like and a query they’ve already tried but didn’t work. That means spending several minutes writing out CREATE TABLE and INSERT statements while, in the meantime, someone else will probably post the answer. If you are posting questions like this, please provide some DDL and DML code!!!

I realize that I don’t understand Stack Overflow’s nuances at this point, but I’ve seen some strange behavior. After posting the correct query to a question, I’ve noticed that the question often gets deleted within a few seconds. Are the posters too embarrassed to leave the question alone once it’s answered?

I enjoy solving SQL puzzles, but please, post your DDL and DML code and leave your question up so I can get those reputation points!

 

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating