shopatlemo
BAN USER
- 0of 0 votes
Answersnumber_one = "193283492420348904832902348908239048823480823"
- shopatlemo in United States
number_two = "3248234890238902348823940990234"
Question:
1) I need to multiply this and get the answer
2) DO NOT CONVERT TO INT AND DO THE MULTIPLICATION| Report Duplicate | Flag | PURGE
Facebook Data Engineer Python - 0of 0 votes
AnswersI have two tables
- shopatlemo in United States
Supplier Table:
Supp_id
supp_name
Invoice Table:
inv_id
supp_id
inv_date
inv_amt
payment_date
paid_amt
I want to list the invoice(s) that have highest invoice_amt for the year 2016.
DO NOT USE MIN/MAX function| Report Duplicate | Flag | PURGE
Facebook Data Engineer SQL
select x.name, x.decision from rsvp x where x.decision ='Y' and not exists ( select null from rsvp y
where x.name = y.name and y.decision = 'N' )
select x.student_id, x.dept_name, x.start_dt, (min(y.start_dt ))as end_dt
from student x left join student y on (x.student_id = y.student_id and x.dept_name != y.dept_name and y.start_dt >= x.start_dt)
group by 1,2 , 3 order by x.student_id , x.start_dt
This is the perfect answer
- shopatlemo June 21, 2017select name, start_dt as start_dt, decision from (
select name, start_dt, decision, rank() over (partition by name order by start_dt desc) from rsvp order by name,rank
) as a where rank=1 and decision='Y';
Table Details:
create table rsvp (
name varchar(30),
decision char(1),
start_dt date);
insert into rsvp values ('Jon','Y', '2016-01-01');
insert into rsvp values ('Jon', 'N', '2016-01-02');
insert into rsvp values ('Linda', 'Y', '2016-01-01');
insert into rsvp values ('Mark', 'Y', '2016-05-01');
insert into rsvp values ('Rob', 'N', '2016-01-05');
insert into rsvp values ('jack', 'N', '2016-01-06');
insert into rsvp values ('Jon','Y','2016-01-03');
insert into rsvp values ('Keith','Y','2016-01-01');
insert into rsvp values ('Keith','N','2016-01-02');
insert into rsvp values ('Rob', 'N', '2016-01-06');