1.
How do you verify whether table has latest statistics?
SELECT tablename, CASE WHEN recent::smallint in (85,341,149) THEN 'UP TO DATE'
ELSE 'OUT DATED' END::CHAR(10) AS Stat_State
FROM _v_statistic
GROUP BY 1,2;
Read more On Netezza here:
Read more On Netezza here:
- Netezza Data Loading Guide
- FPGA-Accelerated Streaming Technology (FAST) Framework in Netezza
- Netezza Architecture
- Slowly Changing Dimensions (SCD)
- Netezza Skew and how to avoid it
- Importance of right Distribution key in Netezza
- Design and Implement Slowly Changing Dimension Type 2 (SCD Type2) in SQL
- Netezza Zone Maps
2. How delete duplicate
records from database?
delete from TEST t1
where rowid <> (select max(rowid) from test t2 where t1.id = t2.id )
3. How do you transpose
table?
Use case or decode statement to transpose table
select
product,
sum(case when year = 2010
then sales end) as year_2010,
sum(case when year = 2011
then sales end) as year_2011,
sum(case when year = 2012
then sales end) as year_2012,
sum(case when year = 2013
then sales end) as year_2013
from sales
group by product;
4. Logic to get first day
of month?
select day(last_day(now() - interval '1
month')+ interval '1 day');
5. Logic to get last day of
previous month?
select last_day(now() - interval '1
month');
Related Articles:
No comments:
Post a Comment