MySQL1 Merge & Joins (5&6)
Home > Preview
The flashcards below were created by user
on FreezingBlue Flashcards.
keyword can be used in front of any SELECT statement, to analyze the optimization of that search.
What makes a column indexed and how to your do it?
- Adding a key
- alter table bob add key(field_name);
Keyword to add at the end of a statement to make it count in a certain column
alter table table_of_contents modify chapter int unsigned NOT NULL auto_increment;
Make a primary key
alter table table_of_contents add primary key(chapter);
Key word to make an alias
if you want to join two tables what do you use?
What do you do to reference a field from a certain table if there is more than one table?
- , as in select * from bob, mary
- . as in bob.fieldname, mary.fieldname
Difference between an inner join and outer join
inner join contains items that are only included in both tables outer join contains items only in one table.
In an outer join, what key words to you use to combine everything from one table to another?
- left join (left outer join) as in
- select * from table_of_contents left outer join chapter_topics ON table_of_contents.chapter = chapter_topics.chapter;
Keyword like where, but is not required
key word that allows you to merge results by one field, listing only the first entry in the field for repeating enties
- group by
- mysql> select * from table_of_contents as tc, chapter_topics as ct where
- -> tc.chapter = ct.chapter GROUP BY tc.chapter;
Word used at the start of a sql search to prevent duplicates
- select DISTINCT tc.chapter, tc.chapter_name from table_of_contents as tc, chapter_topics as ct where
- -> tc.chapter = ct.chapter;
function that lists the number of different field entries for a field
- select tc.chapter,tc.chapter_name,count(ct.topic) from table_of_contents
If you are using group by what do you use instead of where? Does it go before or after group by?
Having...which goes AFTER group by
change the order of the results in reverse order?
order by fieldname descending
function to have only a subset of results
- 0 is starting row
- 1 is number of rows to display
Home > Flashcards > Print Preview