Friday, September 11, 2009

USE OF EXISTS AND NOT EXISTS

SELECT table_name---same
FROM user_tables t
WHERE EXISTS (
SELECT table_name----same
FROM user_indexes i
WHERE i.table_name = t.table_name);


SELECT COUNT(*)
FROM user_tables
WHERE srvr_id = 503;


SELECT COUNT(*)
FROM dual
WHERE EXISTS (
SELECT NULL
FROM user_tables
);

SELECT table_name
FROM user_tables t
WHERE NOT EXISTS (
SELECT table_name
FROM user_indexes i
WHERE i.table_name = t.table_name);

No comments: