In table three columns with 1 milion records(here there is
no sequence values) i want add one more column with
sequence values from the first how it is posible?

Answers were Sorted based on User's Feedback



In table three columns with 1 milion records(here there is no sequence values) i want add one more..

Answer / shekharjchandra

Hi
That's a simple one . (if table is tab1)

1. Add column first
ALTER TABLE tab1 add col1 number ;

2. Update the col1 of tab1
UPDATE tab1 SET col1=ROWNUM.

This will populate all the rows in sequential numbers.

Hope this solves u r problem
regards
JC

Is This Answer Correct ?    16 Yes 1 No

In table three columns with 1 milion records(here there is no sequence values) i want add one more..

Answer / saraswathi muthuraman

SQL> desc ts_200;
Name Null? Type
----------------------------------------- --------
A NUMBER


SQL> alter table ts_200 add b number;

Table altered.

SQL> desc ts_200;
Name Null? Type
----------------------------------------- --------
A NUMBER
B NUMBER

SQL> select * from ts_200;

A B
---------- ----------
1
3
7

3 rows selected.

SQL> update ts_200 set b=rownum;

3 rows updated.

SQL> select * from ts_200;

A B
---------- ----------
1 1
3 2
7 3

3 rows selected.

Is This Answer Correct ?    7 Yes 3 No

In table three columns with 1 milion records(here there is no sequence values) i want add one more..

Answer / mohamed shahid

CREATE TABLE T AS SELECT ROWNUM AS seq,emp.* FROM emp;

Is This Answer Correct ?    0 Yes 2 No

In table three columns with 1 milion records(here there is no sequence values) i want add one more..

Answer / kondeti srinivas

select rownum,tablename.* frome tablename;

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More SQL PLSQL Interview Questions

How to use distinct and count in sql query? Explain

0 Answers  


What is an exception in pl/sql?

0 Answers  


What is sql profiler in oracle?

0 Answers  


How to use sql*plus built-in timers?

0 Answers  


What is a system versioned table?

0 Answers  






What are the various restrictions imposed on view in terms of dml?

0 Answers  


What is on delete restrict?

0 Answers  


what is a scheduled jobs or what is a scheduled tasks? : Sql dba

0 Answers  


SELECT emp_num, years, SUM(salary) FROM sales UNION ALL SELECT emp_id, SUM(takehomepay) FROM marketing What error is present in the sample code above? 1. Queries being combined with the UNION ALL statement are not allowed to have SELECT lists with a different number of expressions. 2. You are not allowed to use aggregate functions within two queries joined by a UNION ALL statement. 3. The UNION ALL statement incorrectly combines the "years" result from the first query with the "SUM (takehomepay)" result from the second query. 4. Unless the UNION ALL statement is replaced with a UNION statement, the queries will return duplicates. 5. The "emp_id" column from the second query must be renamed (or aliased) as "emp_num" so that it corresponds to the column name from the first query. Otherwise, the queries will not execute.

3 Answers  


What is string join?

0 Answers  


What is a column in a table?

0 Answers  


What is procedure function?

0 Answers  


Categories