Suppose I have a database with a bunch of tables in it. Some of the tables have a stockkey field, but some don’t. Is there a single query that I could run that would display a list of the tables that have a stockkey field? I could write a script that iterated through all of the tables, running a “show table” against each one, but it seems like there might be a way to do it in sql alone.
Original: craschworks - comments
no subject
Date: 2007-09-05 04:56 am (UTC)For instance, on Microsoft SQL Server, there is a table called dbo.syscolumns that contains a list of metadata about the columns in every table in the system. Oracle and MySQL have similar tables, but I don't know what they're called or what their schema is, as there is no standard for an RDBMS data dictionary.
no subject
Date: 2007-09-05 05:00 am (UTC)no subject
Date: 2007-09-05 05:50 pm (UTC)no subject
Date: 2007-09-05 04:56 am (UTC)I'm just making it up. Just guessing. I try yelling at the monitor. It hasn't produced results yet, but in the movies it almost always results in the computer springing into life and becoming the main character's best friend.
Also: try pounding your fists on either side of the keyboard. It won't make things work, but it might cause coffee to spill on a bunch of wires... and that will again cause the computer to take over every electric appliance in the house and randomly murder people.
It's worth a shot.
Also: clean the gunk out of the mouse.
Unplug it and plug it back in.
no subject
Date: 2007-09-05 10:51 am (UTC)