How do u count no of rows in a table?
Answers were Sorted based on User's Feedback
Answer / gunturajesh
select count(*) from table will give the number of rows in
the table including null values
Is This Answer Correct ? | 32 Yes | 3 No |
Answer / bj
select count(1) from <table_name>;
By this also we can count no of rows in a table.
Is This Answer Correct ? | 19 Yes | 2 No |
Answer / prakash kumar
select max(rownum)from table_name;
this will also give number of rows in your table
Is This Answer Correct ? | 9 Yes | 3 No |
Answer / prabhudatta barick
Please ignore my first answer...
as By default this job runs within a maintenance windows
between 10 P.M. to 6 A.M. week nights and all day on
weekends.
to get the exact record please use this
ANALYZE TABLE <table_name> COMPUTE STATISTICS;
SELECT num_rows
FROM dba_tables
WHERE table_name = '<TABLE_NAME>';
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / prabhudatta barick
Automatic Optimizer Statistics Collection
By default Oracle 10g automatically gathers optimizer
statistics using a scheduled job called GATHER_STATS_JOB.
As it gathers table statistics automatically
so no need to gather table statistics before
running this query.
SELECT num_rows
FROM dba_tables
WHERE table_name = '<TABLE_NAME>';
This will give u the total no. of records in a table....
Is This Answer Correct ? | 1 Yes | 0 No |
what is the boundary line in varrays?
How to add Foreign key in a table after the creation of the table?
Where is pl sql used?
what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba
What are analytical functions in sql?
How does postgresql compare to "nosql"?
What is a mutating table
. have a tablle like this: cust acc ----------- a 1 b 2 b 3 c 4 c 5 c 6 I Want below o/p: cust acc --------------- a 1 b 2|3 c 4|5|6 Please any one can you have any ideas share me. I have urgent requirement. CUST ACC a dv b fg b bh c mk c cl c so result:- A B c dv fg mk bh cl so
what are tables and fields? : Sql dba
Why do we use sql constraints? Which constraints we can use while creating database in sql?
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.
what is recursive stored procedure? : Sql dba