SQL has the flexibility to join tables on any column(s): Think of example where joining on something other than keys would be needed. Write the query both as English sentence and SQL.
Being able to join two tables is extremely useful in SQL, in fact that is probably where the languages strength is at. Sometimes however, you may need to join two tables that aren't necessary related. This is where something like UNION would come into play. With union, for example, say you can have a table that relates to employees and another to customers. With union, even if employees and customers don't relate to each other in anyway. You can still get a full list.
Example: SELECT * FROM customer.customername UNION SELECT * FROM employee.employeename
On the SQL language: What do you think of SQL as a query language?
From my experience using SQL so far, I am starting to not really be a fan of it. To me, some of the syntax just feels like talking to one of those call robots when calling a business; it simply does not feel intuitive. What I am having most trouble with is that in previous languages like Java, for example, everything was very step 1, step 2, step 3 like. However, SQL to me seems very vague, perhaps I just need more practice...
No comments:
Post a Comment