SQL NOTES FROM Ca

you should learn sql
help me out
D and W are both learning programming languages, but i get the feeling that once you learn how to do it, you can do it faster~
co: is there some kind of book for it?
i'm up for the challenge
i usually just look up what i need
if not there, then there's usually PLENTY of examples on the net
co: cool
Ca: see, what i need is some sort of join, either a left or a right
i always get them mixed up
i have a bunch of IDs in one table, and a bunch of IDs on the other table and what I want to do is find out which IDs don't exist in the first table
co: what is "INNER JOIN"
Ca: if you can figure that out wednesday or friday, let me know =D oo you have admin access
co: what's the inner?
Ca: inner and outer is the same as left and right
co: ok
Ca: just different names
co: and you have a list of ID numbers
and you want to see which ones don't exist?
Ca: nod
co: hmmm ok
Ca: you have access to the database
so what you're doing are all select statements
i want to see which IDs are in the plants_profile table which are NOT in the plants table
because those IDs need to be deleted
I don't want you to delete though, just give me the SQL statements that you figured out
and to get the IDs from the plants table you do this: select plant_id from plants
co: ok
i'm scared to delete anyway
might mess something up
Ca: to get the IDs from the plants_profile table, you do this: select distinct plant_id from plants_profile
so now you have to find the join to connect them
usually it looks something like this
co: what is the * ?
and can you combine like in html?
such as FROM table_name1 table_name2
Ca: select plant_id from plants inner join plants_profile on plants.plant_id=plants_profile.plant_id
the * is like a wild card, give me all columns from the table
co: oh ok
Ca: there are four statements you can make like the one i just did above
either the plants are first or plants_profile is first, or it's an inner join or an outer join
one of them is going to give you ONLY what's in both tables
one of them is going to give you what's in both tables and put null values where the table on the left doesn't have anything to connect with the table on the right
you might have to do some sort of negating command to get what you need
what happened with the old database is i don't think i implemented the delete function correctly
or something
so there's a bunch of crap in there that shouldn't be in there

No comments:

Post a Comment

INSTANT TIME MACHINE!

CERCA TROVA:

TAG MANIA

music Aerial friday5 hawaii yoga samadhi bikeventure school book concert lists science poweryoga hawaii bicycle food la dispute live show microbiology movie movies spring break spring break 2015 vinyl 2010 Book review cardistry cooking destiny phantogram reads rooster teeth silversun pickups touché amoré work EmM Stephen king beach books coffee metric movie review pyhiflygirls shopping virology b9 bacteria bus clothes comics deafheaven drug church interpol mlt roman literature socks vales 6131 YYY aerial problems amyz art balance and composure batman blood blood bank catullus ceremony cheese coffeesundays cover dengue earl grey exercise gymnastic linguist koji memories mlt adventures molecular motion city soundtrack needle work nightwing no sleep records octopus other realms pacific rim raveonettes recipe republik review saga scattegories sspu summer sunbather taking back sunday tattoo tiny cats tissu tycho wiwt yummiestars #hrf2015 2014 accident adult swim singles afi album review anakin anamanaguchi angels and airwaves asm beer best of blast bruises cadence caitlin doughty campy cards carnavas carpe noctem checklist manifesto chemistry chinese christmas concussion culture abuse dc comics deathwish descendents descender dress fight club fishing glow flow goodtime boys grouplove handstand heart shaped box hematology hip key how to with joel and adam hungry ear hurricane interstellar joe hill lab last look lily allen live lucky hell lululemon lyra makeup manoa megwin melissa modern baseball mr mercedes nails ncbi nerves never come undone orange bang poetry pool ps4 research rick and morty rohnert park rtpodcast sandwich sephora sequencing shameless shave ice sick sirens sleep society of s star wars static trap stereochemistry strava sviib sysmex the donnas the modern waikiki the winter passing third man records thrice tove lo training for aerial on the ground unpopular opinion waiola weezer xcm yeah yeah yeahs #hrf2016 #myhour #tdf2015 '68 007 100% 11-22-63 16s 1970s 1999 2011 2015 35mm 3hive 7seconds 90s :) @8_semesters @wild_twinkies Carrie Fishbones GITS Godzilla Groundhog Day HST L-cuts L4D2 MCR Pink vans RIP SEM Streptococcus The Great Wall UH a favor house atlantic a girl walks home alone at night abraham lincoln vampire hunter aculpture aesop rock agar aji fry ala moana alam alfa beach american hustle antics arcade fire art of play atlas genius atul gawande autoclave b sides backstage bai san bakasana baking bandcamp battlewagon bayonetta beach house beach slang beastie boys beats begiragons big bang theory big grams bike biochem biomusicology birds in a row bitter clarity uncommon grace black dress blaisdell blink 182 bond boscia brad meltzer brambles brazil brew bridge 9 bro force broke for free bronchial wash burrito buxom buy local calzone campy group campylobacter cancer candida candida albicans candy hearts carrot carrot cake cascade casket lottery catbird cayetana cdc cheap monday chet faker chinese new year chirashi chloe cho dang chores chozo cinerama circuits circulus cisco kid clarity clones of the queen cloning cls coexist coffee stout coheed and cambria coincidence coli com truise comicon common reactor conference constantine contortion cotq cremation crow csf cursive dads daiei dan and dave daniel dae kim dashboard david rees day by day records dead weather deadlines dealersgrip death deep blue defender class delerium demetri martin destiny 2 detective dee devart dhm diamond youth dick grayson dinosaur pile up disco discordia discount dance discovery distance/closure divination diy dl dna dntel does it work don quijote donnie darko doodles double ankle hang down the cliff dragonette dreamcar dreams dscvry dustin nguyen e. coli earth wind and fire ebola edge edward benz 27 times el pintor el-p electricity elle king emb emily haines enbalming enjoy your burrito epidemiology eqs esr evenings event evil needle exam exotica fall behind me family fashion fat bob fatale fck felix cartal fiction firefly fitz and the tantrums flash flash fact fletcher c johnson flight facilities flight of the conchords forever 21 forgettable formula x fountains of wayne frameworks franz ferdinand fresh cafe friday the 13th fuck yes fulton funeral game of thrones gate gatsby genetics ghost bc ghost feet ghost in the shell ghost key ghostly giant glass good charlotte gpc grant imahara grayson green river gtd guardians of the galaxy guest blogger gym class heroes habits haemophilus influenzae haim halloween handwriting harlem harmonica harrow heavy circles helena bertinelli hello hellogoodbye hematocrit heroquest high water marks history channel holiday mart homework houdini howl howl gaff gaff hummus hxc i love crazy tags iasip ice cream identity crisis in all dishonesty in and out of control in gratitude instagram instax interpro into the wayside intrepidity ipod iwant iyo udon jack johnson jack white japan jaspas jejuni jellys jimmy fallon jisuk jjak jld jock john wick joy departed joy division jpb julian casablancas justice league justice league dark kaimana kakaako kapiolani kat von d kegg keratin kiki kimchi kimchijeon kingsman kitsune kittygeddon klaxons koolau ballroom korean koundinyasana lab report latte art lazaretto le castle vania leahi left 4 dead 2 leotard leptospirosis les savy fav let me in lgc library light we made like like drive in lil gothams liquid nitrogen lismore lit little richard llea lol lolita loma prieta longboard lookbook love luster luck lust lust lust lymbyc systym magic magic island magnolia cafe mah jong maiden heist mail day mais2 major league makapuu maldi-tof martin denny martin solveig marvel matty matheson mavica me earl and the dying girl me first and the gimme gimmes media memento memento bento meta metamorphoses mf doom michael crichton micr490L midweek milk tea mind of a chef miss manners mls adventures modest mouse mogwai mohawk monty python monuments men moon moose blood morbid mortdecai motown mr robot mr tea my chemical romance my sharona naked juice ncis ncisla nerd nerdist new eagle cafe new politics new scene nickleback nicole atkins nightmare before christmas nijiya nimitz no backup plans no doubt noisey nonfiction novo biocin ofelia only in youth origa osaka loop line ovid pai gow pam pancakes pandemic paramore paranormal activity part time job party past present felix patreon patrick kindlon pcr pe'ahi peanut butter and jelly peb pecan tree penny dreadful performance peter pan collar pfam photog physics pita pizza plants plastic metal platelets poker pole polefiction politics popo popoitis post office potpourri pow wow hawaii prey primer prince procrastination protein pu er pun punk pyogenes pyromaniac quiche r dorothy wayneright rage ramblings ramen random random weirdos rap record shop dude records red machine redbone reflective replacements revision rhcp ripd roller skates rooms of the house roxy rozwell kid rsd run for cover run the jewels sailor moon sakura mochi salem's lot salonpas samurai ice cake sapling scans scarjo scary scorpion sds page searching for a pulse sed rate seeking a friend for the end of the world self defense family self published separation sequins seven psychopaths shadowplay shaloha sheezus shimmering stars shoes shout out louds show sierra nevada sikdorak silly girl sinclair library skateboard skyfall slipshift small brown bike smart db smoke gets in your eyes snl somnio sorority noise soundcloud speech and debate sphere spyral stamps staph staphylococci star trek steam stellastarr* straddle ups string db suetonius suicide squad suis la lune sunday morning at a funeral sunny day real estate surya namaskar sushi sushi king swim swoon taco tuesday taiyaki tantalus target taste tea taunt tcb technical writing tempura tf2 tguk thanksgiving the angels the audition the bougies the calm blue sea the chase the get up kids the hives the killers the kingsmen the kinks the pipettes the quick the raconteurs the russian the saddest landscape the supremes the things we think we're missing the voices the weight of the world the wolfpack the xx there's nothing thieves like us threadless three cheers for sweet revenge thursday ticket to ride tideland tigers jaw time travel tiny me title fight tittibhasana toby tokyo milk tom moffat topshelf records totoro tour de france transfection transformation tricks trojans tron tv two dots udon uniprot unknowns unrelatableexperience vacation valve vampire vegetables verde verse vertigo vibrio vice video dump volary walking backwards man walmart waning star want to read war wednesday addams welwing what we do in the shadows white house down white stripes whole foods wildhoney wildlife wired won tons workaholics wu xia xbox 360 xbox one xur yoga ball yogagypsy zatanna zero zippys zombie zones