Saminnet-Search Article Wiki Forum Piwigo SNS Cloud vtiger Sugar
DB2 Alias

  • MySQL
    • MySQL Tunning my.cnf (106) Tue27,10:08am

      最近、ありがたいことにいいねがめちゃめちゃ増えております。正直自分もびっくりしてますので、少し精査した内容のtems/9c5eaee3c986cff6#%E7%8A%B6%E6%B3%81" style="color: #6200ac;">状況 僕が担当したサービスが 秒間5リクエスト でサーバーダウン。今までは ただ波が去るのを待っていた とのこと。そこで設定変更、およびチューニングをした内r: #6200ac;">問題 DBサーバーがダウンしてサービスが止まり、その時間だけ売り上げがゼロ。事業としてだけでなく、関連する全てに迷惑をかけていました。僕が担当…

      Read More...

DB2 Alias

This chapter describes the creation of alias and retrieving data using alias of database objects.

Introduction

Alias is an alternative name for database objects. It can be used to reference the database object. You can say, it is a nick name for database objects. Alias are defined for the objects to make their name short, thereby reducing the query size and increasing readability of the query.

Creating database object aliases

You can create database object alias as shown below:

Syntax:

db2 create alias<alias_name>for<table_name>    

Example: Creating alias name for table “professional.customer” table

db2 create alias pro_cust for professional.customer    

If you pass “SELECT * FROM PRO_CUST” or “SELECT * FROM PROFESSIONAL.CUSTOMER” the database server will show the same result.

Syntax: [To retrieve values from a table directly with schema name]

db2 select*from<schema_name>.<table_name>    

Example: [To retrieve values from table customer]

db2 select*from professional.customer    

Output:

CUSTID  FULLNAME    PHONE
----------------   ------------ 
100     ravi        9898989 
101     krathi      87996659 
102     gopal       768678687 
  
  3 record(s) selected.    

Retrieving values using alias name of the table

You can retrieve values from database using alias name as shown below:

Syntax: [To retrieve values from table by calling alias name of the table]

db2 select*from<alias_name>    

Example: [To retrieve values from table customer using alias name]

db2 select*from pro_cust

Output:

CUSTID  FULLNAME    PHONE
----------------   ------------ 
100     ravi        9898989 
101     krathi      87996659 
102     gopal       768678687 
  
  3 record(s) selected.    

Comments   

 
0 #1 Guest 2018-10-05 16:12
Excellent blog! Do you have any hints for aspiring writers?
I'm hoping to start my own site soon but I'm a little lost on everything.
Would you advise starting with a free platform like Wordpress or go for a paid option? There
are so many options out there that I'm completely overwhelmed ..
Any tips? Thank you!

Here is my web-site :: minecraft
Quote
 

Category Database

TweetTweet Share on LinkedInShare on LinkedIn Share on Google+Google+ Submit to RedditReddit Publish on WordPress WordPress Send emailSend email