May 18, 2019


Hello Friends, today I am going to share SQL syntax to create Table by copying data from existing table. Some times it require to create new table for data according to data nature.

Say, you have CUSTOMER table which contains data for MALE, FEMALE and CHILD category. Now you require to create three (3) new table as named CUSTOMER_MALE, CUSTOMER_FEMALE and CUSTOMER_CHILD

My existing table name is DEMO_CUTOMERS and I will create new Customer table

TASK 1
CREATE NEW TABLE WITH ALL DATA FROM EXISTING TABLE

Connect to Oracle Express Edition 11g Database and using my schema name PIJUSH

See my existing Table by using SQL comment SELECT * FROM DEMO_CUSTOMERS



Query which I used for copying data from one table to new table
CREATE TABLE NEWCUSTOMERTABLE AS
SELECT  CUSTOMER_ID, CUST_FIRST_NAME, CUST_LAST_NAME
FROM DEMO_CUSTOMERS

Run the query

Query create new table names as NEWCUSTOMERTABLE

Now view the data in new table, run query SELECT * FROM NEWCUSTOMERTABLE
Result is



TASK 2
CREATE NEW TABLE WITH  SPECIFIC DATA FROM EXISTING TABLE

Create second table where customer name is WILLIAM

Query which I used
CREATE TABLE NEWCUSTOMERTABLE_2 AS
SELECT  CUSTOMER_ID, CUST_FIRST_NAME, CUST_LAST_NAME
FROM DEMO_CUSTOMERS WHERE CUST_FIRST_NAME = 'William'

Run query

See the result


You will notice that, in case of first query, all customer data copy from old table and paste in new table. But for second query, only specific data as mentioned in condition "WHERE CUST_FIRST_NAME = 'William' inserted into new table.



When users click on SESSION, oracle application ask for session ID and password. The default user HR session are locked.


Click on ALL PROGRAM
Find the Oracle Database 11g Express Edition
Click ob Run SQL Command Line


Type CONNECT and execute the query



  • Enter username like system
  • Enter password - password of the database which you input at the time of database installing
  • After password press enter
  • Connected

  • UNLOCK USER
  • Run SQL query "ALTER USER HR ACCOUNT UNLOCK"
  • Press Enter

  • CHANGE USER PASSWORD


Enter in Oracle Database.

Thanks


In my last articles, I shared notes regarding HOW TO CREATE GROUP COMPANY. In this lesson, I am going to show how to create NEW COMPANY in SAP.

As SAP mythology, users need to maintain financial statement and legal compliance at Company Code level. Therefore as per legal entity, users need to DEFINE COMPANY CODE. Also Company Code used to define company as per continent or region. For example AUDI INDIA LTD, AUDI UK LTD OR AUDI USA LTD.

We will copy from SAP Default company and create our new company. After creation, we will modify necessary change as per our company profile. We will copy from existing company because it will help us to copy SAP default table from existing company to new company.

Before creating the New Company Code, please create Group Company for Consolidated Financial Report, please visit How to Create Group Company in SAP

Therefore, the Company Code creation process divided in two step
STEP -1. Copy from Existing Company
STEP -2. Edit company profile data after copy from exsting company

STEP -1
COPY COMPANY CODE FROM EXISTING COMPANY


  • After logged in, run comment SPRO in t-code bar
  • Follow the navigation path as below image or run T-Code OX02 


  • Select Copy, Delete, Check company code and Double click this option


  • Click on Copy icon 
  • After compiling the table, this window will open




  • Insert From Company Code, for India I am selecting 4300 Company Code
  • New 4 Digit Alpha Numeric Number insert in TO COMPANY CODE field, I am inserting R111 i.e. my new company code will be R111
  • Click continue

  • We will create our own G/L master. So please select NO

  • Please select NO if you would not allocate different currency

  • Click on Continue by cliek tick icon

  • Application shows warning message. Read the message and click on Continue.

  • We will create our own Number Ranges for posting, please ignore this step and select NO

  • Now create our won TRANSPORT REQUEST number. Please save the number in one place. When we are going to transfer configuration from TESTING SAP CLIENT to LIVE SAP CLIENT, we need to use the TRANSPORT REQUEST NUMBER.

  • Company Code 4300 tables copied to R111 successfully.


STEP -2

EDIT COMPANY CODE DETAILS


  • After complete Step 1, click on BACK button

  • Double click on EDIT COMPANY CODE DATA

  • Click on Position and search the company R111

  • Double click on company name and edit the data as require
  • Click on Save

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget