Skip to main content

Writing A Good Query

When it comes to reading code no body will like to read a wall of text specially in programming. Some of the best practices to make query code readable, as well as easier to understand, is to follow clean formatting rules throughout your SQL query. Some good practices to write a good query is: 

- Use comments to describe what SQL does. If you’re modifying existing SQL, add the author’s name, the date, describe the modifications, and avoid questions. Don’t overdo it and comment on the obvious

- Put each major SQL statement on a new line

- Use CamelCase capitalization and do not separate name parts with underscores: TableName, instead of Table_name, or use lower case and underscores to separate name parts: table_name

- Set standard abbreviations for frequently used objects, such as tbl for tables, or sp for stored procedures

- Use single quotation for characters, strings, binary and Unicode –

- Use indenting to align wrapped long lines

- Use parentheses in complex mathematical expressions

It is also important to use line breaks to improve readability, as well as separating lines of codes that execute certain tasks as different code blocks. 


sources: 

http://solutioncenter.apexsql.com/sql-formatting-standards-capitalization-indentation-comments-parenthesis/

Comments

Popular posts from this blog

Your Online Life, Permanent As a Tattoo

View TED Talk Link Watching this TED talk titled “Your Online Life, Permanent As a tattoo” talks about how the use of social media can be the same as having a personal tattoo. Juan Enriquez, the main speaker, begins the presentation by using visual pictures of what tattoos can represent in a person's life. Using pictures, he shows the audience that tattoos can be beautiful, intriguing, intimate and also builds humor by stating that they can be mistakes. After showing the audience these different types of tattoos, he starts to question them about what if social sites and services were to become personal tattoos. At this point he begins to add more information on how the way we express ourselves on  social media can impact and create our  “Electronic Tattoo”. Juan states how difficult it is to get away from our electronic tattoos, since forms of technology, like facial recognition are getting better and better at recognizing people's faces. He adds up that if someone...

WHILE and IF statements

A while loop statement will repeatedly execute a statement as long as the given condition is true. If the while loop's condition is set to true then the program will go into the loop, and will keep looping as long as that condition remains true. For example: int score = 15; while (score  <  20)       {             Console.WriteLine("value of score: {0}"), score;              score++;        }        Console.ReadLine(); In this example the program will go into the loop for as long as the value of score is less than 20. Once it's in the loop it will increment the value of score by one, then it will check if a is still less than 20. Once the value of score reaches 20, it will no longer go into the loop as the condition will no longer ...

MATC Event Planner Project

In my IT Project management class I had to work with team mates to create a project that we could essentially propose in the real world. The project we created was an event planner that MATC organizations could use to create events, since there is no streamlined system in place today. During this process I learned the different methodologies that people can use to create and successfully develop a project. The time I spent in creating and working with my team in this project has taught me the importance of planning a project instead of jumping into it right away.    Here is the link to my final project's proposal document:  Project Proposal Project Presentation