Berkeley CSUA MOTD:Entry 12424
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/04/03 [General] UID:1000 Activity:popular
4/3     

2004/2/26-27 [Transportation/Car, Computer/SW/Database] UID:12424 Activity:nil
2/26    Suppose I have a database of car dealers and the cars they have in
        stock.  I want to query this database for N cars that I'm
        interested in, something like
        SELECT dealerId, carId FROM cars WHERE (carId=1 OR carId=2 OR carId=42)
        The problem is, I need to sort the result such that a dealer who
        has all N cars I'm interested in is ranked higher than a dealer that
        has only 1 or 2 such cars.  Can this be done with some sort of
        aggregate function?  Something like
        SELECT dealerId, count(dealerId) as numCars, list(carId)
          FROM cars WHERE (carId=1 OR carId=2 OR carId=42)
          GROUP BY dealerId
          ORDER BY rank
        where the output would be
        dealer  | numCars       | list(carId)
        ----------------------------------------
        Fred      3               1,2,42
        Bob       2               1,2
        Tom       2               1,42
        Jerry     1               2
        Thanks in advance.
        \_ Please tell me this is for work.
           \_ I would, but then I wouldn't get the input from the smart types
              who do it because it's challenging. -op
              \_ Your question was better when it was jive'd.
                 \_ Yo! Yo!  Shiznitz!  Wez be needin' ah jive update!
2025/04/03 [General] UID:1000 Activity:popular
4/3     

You may also be interested in these entries...
2012/7/29-9/24 [Transportation/Car, Transportation/Car/RoadHogs] UID:54446 Activity:nil
7/29    Is it really true that we subsidize auto driving to the tune of
        $5k/yr? Shit I could probably hire a private driver for less...
        http://tinyurl.com/cars-suck-ass
        \_ You might have missed the point.  Hiring a chauffeur to drive your
           private vehicle won't change the amount of gasoline your private
           vehicle use or the amount of real estate it uses on freeways and
	...
2012/7/9-8/19 [Transportation/Car] UID:54433 Activity:nil
7/9     http://infoproc.blogspot.com/2012/07/nice-guys-finish-last.html
        A study at the Berkeley Marina intersection shows that people
        with nice asshole-cars break the law more frequently.
        \_ Alpha animals.
            \_ sense of entitlement coupled with willingness to pay fines.
               One of the better Freakonomics chapters was about a study
	...
2011/12/5-2012/1/10 [Transportation/Car/Hybrid] UID:54250 Activity:nil
12/5    "Eight Ferraris wrecked in million-dollar pileup"
        http://www.csua.org/u/uw3 (autos.yahoo.com)
        "Police and video reports say the wreck began when a 60-year-old
        businessman from Fukushima driving a Ferrari F430 attempted to pass a
        Toyota Prius, but instead hit the guardrail.  That set off a chain
        reaction among the cars driving in a tight formation behind the lead
	...
2011/7/10-8/2 [Transportation/Car/Hybrid] UID:54141 Activity:nil
7/8     Is there some reason we can't have mass market nat gas cars?
        \_ Not enough infrastructure for refuing.  Chicken and egg.
        \_ Not enough infrastructure for refueling.  Chicken and egg.
        \_ It has less than half the energy density of gasoline.  -tom
           \_ So you have to compress it, which results in huge explosions
              during a crash. Same for flywheel tech.
	...
2010/8/23-9/7 [Transportation/Car] UID:53931 Activity:nil
8/23    "China's nine-day traffic jam stretches 100km"
        http://news.yahoo.com/s/afp/20100823/sc_afp/chinaroadtraffic
        "... the jam between Beijing and Jining city had given birth to a
        mini-economy ..."
        And we think traffic in L.A. is bad.
        \_ Actually those of us who have travelled don't.
	...
2010/8/4-25 [Transportation/Car] UID:53909 Activity:nil
8/4     "China Plans Huge Buses That Can DRIVE OVER Cars (PHOTOS)"
        http://news.yahoo.com/s/huffpost/669166
        WTF!?
	...
2010/1/8-29 [Transportation/Bicycle] UID:53617 Activity:nil
12/8    http://latimesblogs.latimes.com/lanow/2010/01/cyclist-sentenced.html
        Car driver gets 5 years for assualting bicylists with car.
        \_ How many years do cyclists get when they run red lights?  I almost
           hit one last week when a cyclist ran a red light in front of me
           while I was about to start moving on my green light in Fremont.
           \_ How many years do motorists get when they run red lights? I
	...
2013/4/9-5/18 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Apps, Computer/SW/Languages/Perl] UID:54650 Activity:nil
4/04    Is there a good way to diff 2 files that consist of columns of
        floating point numbers, such that it only tells me if there's a
        difference if the numbers on a given line differ by at least a given
        ratio?  Say, 1%?
        \_ Use Excel.
           1. Open foo.txt in Excel.  It should convert all numbers to cells in
	...
2011/12/20-2012/2/6 [Politics/Foreign/Asia/China, Computer/Rants] UID:54268 Activity:nil
12/20   A higher percentage of people in China than in Pakintan have an
        unfavorable view of China:
        http://www.pewglobal.org/database/?indicator=24&response=Unfavorable
        Go figure.
        \_ damn these self critical liberals!
	...
2011/11/27-2012/1/10 [Computer/HW/Drives] UID:54244 Activity:nil
11/27   CalMail has been down for a few days (hardware failure and database
        corruption -- sounds like fun!) and is starting to come back online.
        Looks like they're planning to outsource all campus mail to either
        Google Apps or Microsoft 365 as part of Operational Excellence.
        <DEAD>kb.berkeley.edu/jivekb/entry!default.jspa?externalID=2915<DEAD>
        \_ http://ist.berkeley.edu/ciocalmailupdates/november-30-2011
	...
2010/1/22-30 [Computer/HW/Laptop, Computer/SW/OS/OsX] UID:53655 Activity:high
1/22    looking to buy a new development laptop
        needs ssdrive, >6 hr possible batt life, and runs linux reasonably
        Anyone have a recommendation? Thx.
        \_ thinkpad t23 w ssdrive and battery inplace of drive bay
        \_ Ever wondered what RICHARD STALLMAN uses for a laptop?  Well,
           wonder no more!
	...
2009/10/27-11/3 [Computer/HW/Drives] UID:53474 Activity:nil
10/27   I just read an article that Facebook had moved their database
        to all SSD to speed throughput, but now I can't find it. Has
        anyone else seen this? Any experience with doing this? -ausman
        \_ I hope you're not running mission critical data:
           http://ask.slashdot.org/story/09/10/27/1559248/Reliability-of-PC-Flash-SSDs?from=rss
        \_ Do you have any idea how much storage space is used by Facebook,
	...
2009/9/23-10/5 [Computer/SW/Database] UID:53392 Activity:nil
9/23    I never took CS188, is there a good book that's an intro to formal
        database theory, normalization, etc.?  I've got experience with SQL
        (MySQL & MSSQL), and understand tables, etc.
        \_ You mean CS186?
           \_ Oops, yah.  188 is AI or something?
              \_ That's right.
	...
2009/9/10-15 [Computer/SW/Database] UID:53357 Activity:moderate
9/9     Larry Ellison is a bigger idiot than I thought:
        http://www.techcrunch.com/2009/09/10/oracle-to-sun-customers-and-ibm-were-in-it-to-win-it
        \_ My company's customers are insurance companies. Non-tech corporates don't
           trust open source. Why risk it. They have tons at stake and are willing
           to spend for solid products, support, and consultants who don't have long
           hair. They're being raped by IBM mainframes for millions. An optimized
	...