I am having a huge Oracle database with multiple schema's in it.
i want to describe the entire schema (one schema at a time) with all the tabel's in that schema and the structure of those table i.e. column name , datatype.
how can i do this task using SqlDeveloper ?
Thanking in advance
Use Oracle's views:
all_tables,
all_tab_columns
Related
I've just been studying DBMS. There are a lot of programs for DB. (eg. Mysql, MariaDB etc..)
So I wonder in program, for example Postgresql, can I change data structure each table?
Most of programs are using B-tree, however I hope change data structure each table if I can.
Are you asking if you can change the table structure like adding or removing columns, altering the data type of a column, if yes, then it is possible.
Refer here for postgresql syntax
Refer here for SQL Server/MS SQL syntax
Refer here for MySQL syntax
How to show / list all tables in SAP HANA via SQL?
SAP HANA provides a database catalog (just like most other DBMS) via system tables like TABLES, VIEWS, USERS, etc. ...
These are the ANSI-92 compliant metadata views.
Instead of the INFORMATION_SCHEMA SAP HANA provides these views in the PUBLIC schema (again, like other DBMS do that).
Example:
select * from tables
select * from public.tables
The M_TABLES provides information about the runtime objects that represent tables.
SELECT TABLE_NAME FROM SYS.M_TABLES
To view tables from a specific schema :
select * from SYS.M_TABLES where SCHEMA_NAME ='<your schema name goes here>'
It is my understanding that HANA is compatible with ANSI SQL. If this is actually the case, the following should work:
SELECT * FROM INFORMATION_SCHEMA.TABLES
Of course, I don't have access to a hana instance to prove this.
CORRECTION:
After looking at some documentation, it looks like SAP supports this type of thing through a SYS schema:
https://help.sap.com/saphelp_hanaplatform/helpdata/en/20/cbb10c75191014b47ba845bfe499fe/content.htm?frameset=/en/2e/1ef8
So, I think you would actually select from:
SYS.M_TABLES
A colleague of mine has given me a task to ensure all table name and pages in a stored procedure contains the relevant schemas?
For example if I have a table in a database that is dbo.table1, then in a query if I have:
Select * from table1
He wants me to change it to:
Select * from dbo.table1
This is same for pages that start with Support.
What is the significance of adding in a scheme like dbo. At the start when manually writing SQL? Is it suppose to be better for performance as it seems to know where the tables even if I don't include .dbo at the start?
I'm using SQL server 2012 and its management studio.
Thank you
You may not notice the performance if you write the schema in all of your queries. If you don't specify it, the engine will look through all of your schemas in your databases ( I'm not pretty sure if the engine will check the sys schemas too ) until it finds the table you're getting the data; It's recommended as a best practice to write it because you are telling to the engine what schema need to search the table.
I hope this answer was helpful.
dbo is the schema which is used as part naming convention for tables in a mssql database
look at this post SQL Server edits the table name with dbo as prefix
i'm in need to create VIEWS in postresql 9, to mimic oracle's col table,
basically it should display ALL table fields information from ALL table and ALL database on that server.
Can someone please point me a way? thanks.
Unlike Oracle, PostgreSQL implements the ANSI information_schema.
So Oracle's ALL_TAB_COLUMNS view corresponds to information_schema.columns
But this is only restricted to the current database. It is not possible to get this information for all databases - which is the same for Oracle, ALL_TAB_COLUMNS only shows the columns for the current database (=instance)
More details about the information_schema can be found in the manual
http://www.postgresql.org/docs/current/static/information-schema.html
I don't think is possible to get metadata information from a different database of that you've working right now.
To extract metadata from the current database, take a look here: http://www.alberton.info/postgresql_meta_info.html
At my workplace we have a database with multiple schemas, and some table names may be repeated in different schemas. There are thousands of tables so it is not time-effective to wade through the entire list.
If I do a query where I want to find all the tables containing the word CUSTOMER in their names, for example:
select table_name from all_tables where table_name like '%CUSTOMER%' order by table_name
The results just look like this, with no clues of which schema the tables are located under.
TB_NEW_CUSTOMER
TB_NEW_CUSTOMER
TB_NEW_CUSTOMER
TB_VIP_CUSTOMER
TB_VIP_CUSTOMER
TB_VIP_CUSTOMER
Is there a way to query Oracle so that I know under which schemas the tables are located? We do not seem to have SQL+ because I got a 9000 error when trying the DESCRIBE command. I am tired of scrolling around the Objects tab in SQuirreL SQL!
Thank you very much.
Andy
Why wouldn't you also select the owner of those tables?