I ask Storing date as integer (numeric), what are the advantages here. Look at the code styling, it does not look that professional and easy to grasp.

enter image description here


enter image description here

on this site. Notice how the code is properly highlighted SQL Style.

Shouldn't we style all the code SQL style too so it is easy to grasp, more friendly and look more professional?

| |
  • 1
    "it does not look that professional and easy to grasp." I think I prefer ours! – Jack Douglas Mar 27 '12 at 13:57
  • I definitely like sql style, more readable. – Jackofall Mar 27 '12 at 13:59
  • 1
    by 'sql style' do you mean SSMS style? – Jack Douglas Mar 27 '12 at 14:03
  • 1
    SE's syntax hilighting is done through a third party application and you can hint it. Take a look at this answer for an example. Beyond that, we don't have all that much control. – ConcernedOfTunbridgeWells Mar 27 '12 at 14:08
  • Technically we have a lot of control. We just have to show good reason – jcolebrand Mar 27 '12 at 14:09
  • @JackDouglas, right SSMS style but I do not know from oracle ppl and their insight will be helpful. @ concerned the formatting looks regular to me? Am I missing something. – Jackofall Mar 27 '12 at 14:14
  • I get blue and grey in SQL Developer (Oracle tool bit like SSMS) - no fancy colours. – Jack Douglas Mar 27 '12 at 14:16
  • 1
    What is "SQL style"? Purple for functions, Red for dates, Blue for keywords, etc? Even in your example, I see no colourization of integers or variables. – ypercubeᵀᴹ Mar 27 '12 at 14:20
  • 3
    also in case you don't know a downvote here on meta meand 'I don't agree' rather than 'Its a bad question' – Jack Douglas Mar 27 '12 at 14:21
  • @JackDouglas, disagree even though I upvoted your last comment. If a question is about discussion only, what does the downvote means in that case? I do not agree? – Jackofall Mar 27 '12 at 14:41
  • You asked "Shouldn't we style all the code SQL style too so it is easy to grasp, more friendly and look more professional?", a downvote on the question means "No, I don't think we should, at least not the way your example shows". Comments are voted on as normal of course... – Jack Douglas Mar 27 '12 at 14:43
  • of course, folk vote how they please - I'm just saying what is generally true AFAIK :-) – Jack Douglas Mar 27 '12 at 14:43
  • Hover over the downvote and read: "This question does not show any research effort; it is unclear or not useful (click again to undo)" – jcolebrand Mar 27 '12 at 14:45
  • 1
    @jcolebrand, that is helpful. And yes it does mean it is a good question vs a bad question rather than I agree vs I dont agree. If you want to disagree or agree, there is where comments and answers come in. – Jackofall Mar 27 '12 at 14:53
  • @JackDouglas Unfortunately that is promoted even in the tool tips for voting on meta. See meta.stackexchange.com/questions/75049/… – Leigh Riffel Mar 27 '12 at 14:54

What do you mean "properly highlighted sql style"? You're not very helpful with that, unless you mean "Everything should be formatted like Microsoft SQL Server does things.

What the site uses, and what everyone agrees is "just right" is http://code.google.com/p/google-code-prettify/ which is a "industry standard colorization module". Now, it could be argued that there needs to be a different coloration for SQL code, however, I challenge you to tell me what's the right coloration for MySQL or PLSQL. Because those don't use SSMS.

As for mandatory code-block capitalization ... why should the system auto-correct anything you type in? That's your job, to provide us with the code you're using. If you want to use a T-SQL pretty printer, that will reflow your code, you're welcome to, and I can suggest the add-in I currently use, but that won't win you brownie points with anyone here. We care about code we can read, not what the colors are.

| |
  • Will rephrase it. But part of is discussion also because I do not know everything. There is no standard editor for MYSQL that uses color scheme so I would skip on any SQL which does not have a dedicated editor. 2. We should not be capitalizing the code. This is the poster job. We only need to format it SQL style. It helps in readability a lot. The fact is most of the code here will be SQL, this would be helpful for this professional site. Please allow me some time to make edits - @work Also an insight from oracle ppl will be helpful. I don't know how they highlight code. – Jackofall Mar 27 '12 at 14:09
  • You're welcome to make edits, you probably saw my initial response and not my edited one? :-\ – jcolebrand Mar 27 '12 at 14:24
  • Someone correct me if I'm wrong but capitalization of keywords is part of (a level of) SQL standard, isn't it? – ypercubeᵀᴹ Mar 27 '12 at 14:29
  • @jcolebrand, re-read. Properly highlighted sql style, probably means to adhere to some standards that is used in SQL world, most common would by SSMS and I am sure ppl wont have problem with it. I have not get a chance to use the referenced google syntax highlighting but I have used a couple in Wordpress. The rule is, the color should be bright enough. Our colors are faint, hard to distinguish and too subtle. Importantly our site is only for SQL ppl so it would be better to stick to some kind of sql standard rather than go generic. – Jackofall Mar 27 '12 at 14:36
  • 2
    I challenge "most common would be SSMS" because Oracle is a huge player. I mean, HUGE. So ... Let's not use SSMS as our only basis. – jcolebrand Mar 27 '12 at 14:43
  • 1
    I re-challenge with PHPMyAdmin :) – ypercubeᵀᴹ Mar 27 '12 at 14:44
  • 2
    However, now you're coming to the crux of your suggestion: "the colors are too faint". I don't know if you've noticed, the entire site is faint. Can you suggest something that pops better that doesn't actively have negative contrast? We do have a professional designer that has worked on the site here, and as a professional designer (not a DBA) he felt this was a good mix of readability and "what works for the masses". But if you can make objective style changes, I'm sure he's all for that. – jcolebrand Mar 27 '12 at 14:45
  • I agree on "the whole site is faint" observation. – ypercubeᵀᴹ Mar 27 '12 at 14:51

Not in Favor

In practice there is no standard for SQL syntax highlighting. You might be able to define a standard for one tool on one database platform without any customization, but this seems too narrow to be useful.

When you can't please everyone (or even most people) it makes sense to choose something subtle that can be more easily ignored if the effect is undesirable yet provides enough of a visual difference to be useful. I think our current syntax highlighting does that very well.

Sure in my mind it could be improved on, but mostly in the way of making it similar to one of the several syntax highlighters I use every day. While this might make it better for some people, just as many (or more) would see it as worse.

That being said, I am not opposed to changes in our syntax highlighter particularly if the specific change can be identified. However, I am not in favor of this particularly garish change.

| |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .