473,394 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

A basic question about table addressing

CT
Lets say you have a query

select * from db2.employees;

here what is db2 - is it schema name, database name or table creator
name?

Also, does it make a difference of notation when you are in pc world
or mainframe zos world. I am using v8 on pc and v7 on zos.

Please explain.

Thanks.

T.
Nov 12 '05 #1
6 3597
"CT" <co******@yahoo.com> wrote in message
news:f2**************************@posting.google.c om...
Lets say you have a query

select * from db2.employees;

here what is db2 - is it schema name, database name or table creator
name?

Also, does it make a difference of notation when you are in pc world
or mainframe zos world. I am using v8 on pc and v7 on zos.

Please explain.

Thanks.

T.


It is the schema name. If the schema name is not included in a SQL
statement (create table or the select) , the schema is determined by the
authorization id of the user, or the "set schema" statement (if that has
been issued).

It basically works the same on z/OS but the terminology may be very slightly
different.
Nov 12 '05 #2
It would be the schema name. If there is no schema called db2, it would
be assumed to be the table creator name.

CT wrote:
Lets say you have a query

select * from db2.employees;

here what is db2 - is it schema name, database name or table creator
name?

Also, does it make a difference of notation when you are in pc world
or mainframe zos world. I am using v8 on pc and v7 on zos.

Please explain.

Thanks.

T.


Nov 12 '05 #3
CT wrote:
Objects in DB2 (and I think in teh SQL Standard) can consit of up to 4
parts:
<database>.<schema>.<table>.<column>
(in the OR world you can go further to the right with attributes)
In DB2 UDB for LUW the "current schema" can be freely set to any value.
The only connection between the USER and the SCHEMA is that SCHEMA is
initialized to USER.
Now on DB2 V7 for OS/390 I think SCHEMA is still called SQLID and DB2
for LUW accepts SQLID as a synonym for SCHEMA.

Now how do OWNER and DEFINER get into play here?
The DEFINER is the one who defined the object.
The OWNER may be conceptually be different form the definer.
E.g. I could define an object for you and pass ownership to you.
I don't think DB2 (any platform) supports this transfer at present.

So if you connect to the database and create a table without an explicit
schema name the SCHEMA, DEFINER, and OWNER will all have the same value.
But you can create a table in any schema you have CREATEIN privilege or
a new schema if you have CREATESCHEMA (I think) privilege.
You will still be OWNER and DEFINER of the table.

Bottomline: SCHEMA = directory, CURRENT SCHEMA = PWD, USER = whoami

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #4
N
Is there a way to turn this thing off ?
Can we just do SELECT * FROM table
instead of SELECT * FROM schema.table;

"Serge Rielau" <sr*****@ca.eye-be-em.com> wrote in message
news:ca**********@hanover.torolab.ibm.com...
CT wrote:
Objects in DB2 (and I think in teh SQL Standard) can consit of up to 4
parts:
<database>.<schema>.<table>.<column>
(in the OR world you can go further to the right with attributes)
In DB2 UDB for LUW the "current schema" can be freely set to any value.
The only connection between the USER and the SCHEMA is that SCHEMA is
initialized to USER.
Now on DB2 V7 for OS/390 I think SCHEMA is still called SQLID and DB2
for LUW accepts SQLID as a synonym for SCHEMA.

Now how do OWNER and DEFINER get into play here?
The DEFINER is the one who defined the object.
The OWNER may be conceptually be different form the definer.
E.g. I could define an object for you and pass ownership to you.
I don't think DB2 (any platform) supports this transfer at present.

So if you connect to the database and create a table without an explicit
schema name the SCHEMA, DEFINER, and OWNER will all have the same value.
But you can create a table in any schema you have CREATEIN privilege or
a new schema if you have CREATESCHEMA (I think) privilege.
You will still be OWNER and DEFINER of the table.

Bottomline: SCHEMA = directory, CURRENT SCHEMA = PWD, USER = whoami

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

Nov 12 '05 #5
Ian
N wrote:
Is there a way to turn this thing off ?
Can we just do SELECT * FROM table
instead of SELECT * FROM schema.table;


Yes:

set schema = your_schema;
select * from table;

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #6
> N wrote:
Is there a way to turn this thing off ?
Can we just do SELECT * FROM table
instead of SELECT * FROM schema.table;


Yes:

set schema = your_schema;
select * from table;

Also works without the schema name if the logon user id is the same as the
schema name.
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: nick | last post by:
Hi, I'm pretty much a database beginner and have what I think is a basic question: If I have a table which has a 'status' column and I can have say three statuses: "active", "pending",...
3
by: MX1 | last post by:
Here's a simple query question. I have tables. One is an order table and one is an order detail table. tOrder tOrderDetail The tOrder table contains basic info like customer name, date, a...
1
by: Q | last post by:
Hello you all, I have to create an application which writes data to a serial port, waits for an answer and read this answer from the same serial port. I just don't know where to start. Any...
0
by: gerritmitchell | last post by:
Hi, I have a situation where I need to send a SOAP message from a receiver through multiple intermediaries and then to an ultimate receiver. The intial sender will tell the intermediary where...
23
by: TefJlives | last post by:
Hi all, I'm learning a bit about C, and I have a few questions. I'm not trying to insult C or anything with these questions, they're just honestly things I don't get. It seems like pointers...
1
by: =?Utf-8?B?dWx0cmFuZXQ=?= | last post by:
We have a client that uses .Net that needs to work against our Java (xfire) based WS. My question is: how can a .Net (C#) WS client be configured to not send WS-Addressing headers? The client in...
6
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get...
14
by: MartinRinehart | last post by:
Working on parser for my language, I see that all classes (Token, Production, Statement, ...) have one thing in common. They all maintain start and stop positions in the source text. So it seems...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.