Teradata SQL - What does TableStatsV show? - teradata

What does the TableStatsV show ?
I thought it shows the statistics of every table..
but when I execute
Select * FROM TablesV
I get way more results then I get with executing:
Select * FROM TableStatsV
So why is it like that ? Why does TableStatsV contains not all tables ?

Related

PeopleSoft Query - finding people without leave type

I'm working with PeopleSoft's query manager and I'm having trouble creating a report that will find all active employees who do not have a certain leave type.
I have the two tables (Employees - Non terminated Employees and Leave_Accrual-EE). They are left outer joined. The field in question is PLAN_TYPE. Now, I've tried creating a filter to pull in all employees who do not have plan type 54. The criteria is B.PLAN_TYPE not equal to 54, but that still brings up everyone, it just doesn't bring up the row for 54.
I feel like I'm missing something obvious - maybe I have to create a subquery? If so, I have never done this in PeopleSoft.
Anyone have any advice?
Original SQL screenshot.
UPDATED
This is less of a PeopleSoft question, and more of a SQL question.
The problem you have been running into is that you are doing a per-row filter and excluding only rows that have the undesirable code.
What you need to do instead is exclude all rows for a user that has the undesirable code in any row.
This can be done with a NOT IN or NOT EXISTS query.
e.g.
SELECT EMPLID
FROM TABLE1
WHERE
EMPLID NOT IN
(
SELECT EMPLID
FROM TABLE1
WHERE CODE = 123
)
/
alternately
SELECT A.EMPLID
FROM TABLE1 A
WHERE
NOT EXISTS
(
SELECT B.EMPLID
FROM TABLE1 B
WHERE
B.CODE = 123
AND B.EMPLID = A.EMPLID
)
/
See this SQL Fiddle example to test out the SQL:
http://sqlfiddle.com/#!4/2b0f6/7
To do this in PS Query, you could do this by adding a criteria with a subquery on the right side of the equivalence.
Here is some documentation:
Home > PeopleSoft PeopleTools 8.53 > PeopleSoft Query > Working with Subqueries

Can select individual columns but not select *

I have a SQLite DB that have a corrupted table somehow. I can't access the table in my sqlite gui tool but when I query the same table with just a single column, I get the value fine.
So this do NOT work(SQL Error: SQL logic error or missing database):
select * from table
This DOES work:
select column from table
Result back from this query is the value of column. Perfectly normal result.
Any suggestions how this can happen? Any suggestion for any analysis tool for the actual file?
Seems that one of the columns were corrupt and prevented the select * to fully work. But the question remains, what can possibly be written to this column that prevents a select?

getting error while test query in data source wizard for grid view

I am trying to view data in grid view in asp.net page.I am using oracle databse.I Placed a grid view controller in page and I am trying to bind it with oracle database using datasource wizard. In wizard I chose SQL source, gave connection string. Now i choose a table then it gave query like:
Select * from [table_name]
When I test the query It is giving error like:
There was an error in executing query. Please check the syntax of the command and if present,the type and the values of the parameters and ensure they are correct. ORA-00903: Invalid table name.
The table name is enclosing in square braces. How to get rid of this.
You cann't use [table_name] you need to use table_name only.
It is ok in sql Server [table_name] but not in oracle.
So you need to use like this
Select * from table_name

Oracle - Getting the fields of all tables in a database

I know that to find all the fields of a table I should use something like
sqlplus > desc testtable;
This lists all the fields of a table (here testtable)
But now, I have a list of tables in my database.
What is the way through which I can get the fields of all tables
in a given database using sqlplus?
I tried
sqlplus > desc <Databasename>; which didnot work.
Someone told me to use
sqlplus > select * from INFORMATION_SCHEMA.TABLES ; //gives error.
SQLPLUS > SELECT * FROM INFORMATION_SCHEMA.COLUMNS; //gives some error.
(At the bottom line, I am trying to get the database schema.)
I don't believe that the information_schema tables you can find in other dbs (SQL Server, PostGres, MySQL, etc) is in Oracle. I use to use the ALL_TAB_COLUMNS table to get at that type of information....maybe another alternative.
Link: ALL_TAB_COLUMNS

select Oracle Table from toad without specifying the Schema

Hi Guys I am running an Oracle DB and I have to Write the Schema(Owner) name before selecting the Table. I find this Quite Unnecessary especially when am Logged in as the Table Owner Like:
select * from MUNGAI.Employees;
When am Actually Logged in as user MUNGAI the same Who Created the table. I want to be able to select like:
select * from Empployees;
From this I get the Error On Toad....On SQLDEVELOPER I get No Error and I want to Use TOAD
ORA-00942: table or view does not exist
Any Ideas on How to Achieev this??
I have to Write the Schema(Owner) name before selecting the Table.
No, you don't have to. Why do you think so? Did you even try it?
When you are logged in as the owner of the table you do not have to specify the schema.
Any Ideas on How to Achieev this??
Yes, simply write
select * from Employees;
Again: this works if - and only if1)) - you are logged in as MUNGAI.
1) leaving things like public synonyms aside

Resources