Finding the column in tables? [duplicate] - sql

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
SQL Server 2008: find all tables containing column with specified name
Hi all,
I have 30 tables in my database, in some of tables i have a common column, assume 'eno'. How can i find the tables of 'eno'. Thank you...

You could use the INFORMATION_SCHEMA.COLUMNS system view:
SELECT DISTINCT table_name
FROM information_schema.columns
WHERE column_name = 'eno'

Related

How can I retrieve the table structure from a sql database? [duplicate]

This question already has answers here:
Describe table structure
(13 answers)
Closed 3 years ago.
So basically I want a SQL Command that return every column in the table and the datatype that is in that column and whether is nullable.
You can use information schema.
SELECT
COLUMN_NAME,
DATA_TYPE,
IS_NULLABLE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'yourTableName'

How do I search the name of a table, knowing only one of the table's column name in SQL? [duplicate]

This question already has answers here:
Search an Oracle database for tables with specific column names?
(4 answers)
Closed 7 years ago.
I'm trying to find a table containing a column that I know the name to. Is there some way to do a table search using only the name of the column?
In oracle
select * from user_tab_columns where column_name= '';

Displaying the name and data type of every column in a table [duplicate]

This question already has answers here:
How To Find Datatypes information in oracle schema?
(2 answers)
Closed 9 years ago.
I am working on a Database Management Systems assignment and have been unable to find a way to display the name and datatype of every column in a specific table. I don't know if this is needed but here is the link to the schema I am using for this assignment.
http://mym.cdn.laureate-media.com/2dett4d/Walden/ITEC/ITEC2060/documents/Schema.sql
The employee table is what I am trying to display from.
To list all columns for a specific table:
select column_name, data_type
from all_tab_columns
where table_name = 'EMPLOYEES';
More details in the manual: http://docs.oracle.com/cd/E11882_01/server.112/e25513/statviews_2103.htm#I1020277
If you are using SQL*Plus you can simply run
desc EMPLOYEES
instead.
Most other SQL clients have a similar feature.

How can I SELECT that lists all the field names and their types for a given Db Table? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
SQL Server: How do you return the column names from a table?
Assume that I have Data base table: LunchMenuItems
For the MS-SQL Server, how can I write a TSQL query that :
Lists all the column names and their types in LunchMenuItems table?
Description
This Information can be found in information_schema.columns.
Sample
select column_name, DATA_TYPE from information_schema.columns
where table_name = 'LunchMenuItems'
More Information
COLUMNS (Transact-SQL)

Get list of table names in different schema of an Oracle database [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Oracle: get list of all tables?
How do I list all tables in a schema in Oracle SQL?
I want to list all table in another schema.
connect hr/hr;
select table_name from user_tables;
but I want to skip the "connect" command. I want to run query from another schema.
Is that possible to do?
SELECT TABLE_NAME
FROM ALL_TABLES
WHERE OWNER='OTHER-SCHEMA'