What I have learned from the feedback is that there are many little 'pointers' that help to 'tighten up ' the commands and thus return more reliable data from your query.
For example:-
- Using the = sign with > or < in order to actually include the number typed in the query, rather than just those numbers lesser or greater than it. (e.g. using >= 1980 as opposed to > 1980; the former includes 1980 in the search).
- The use of % to make sure you get as many returns on your query as possible (e.g. using "%Prentice Hall%" as opposed to "Prentice Hall"; the former includes all matches including the name Prentice Hall, not just matches comprising ONLY the name Prentice Hall).
- Keep in mind the difference between numbers and characters - in SQL, 0028007484 is treated as a number, whilst 0-0280074-8-4 is treated as a string of characters. Therefore the command = will work with the former but not the latter; the 'like' command should be used instead.
"The columns of data you want to obtain from the database (SELECT)The table or tables that this data is sitting in (FROM)The clauses that limit this data to exactly what you are interested in and no more (WHERE)i.e.select columnA, columnB, columnC from tablenameXYZwhere criteria1_is_met and criteria2_is_me"I also found that having a diagram of the database's structure was very useful, as it helped me to visualise where and how I could retrieve the data.
No comments:
Post a Comment