Question: code in sql. Please provide a code structure. how we can write a sql query for this problem. for example if event exists how can
code in sql. Please provide a code structure.
how we can write a sql query for this problem.
for example if event exists how can we tell sql that.
Enter a list of people attending an event. Hint: use varray data type as input parameter. Input includes event ID and list of person ids.
- First check whether the event exists. If not print a message saying the event does not exist.
- Next check each person ID, if it does not exist print a message saying the person does not exist.
Next check whether the person id and event id combination are already in event_person table. If so print a message 'No need to insert'. Otherwise insert a row into person_event
Enter a new event including date, name and address. First check whether the same event exists with the same name, date and address. If so, print a message 'the event already exists'. Otherwise insert a row into event table and print out event id.
Print out people's names, phone numbers, and zip code for those whose current status is positive. Finally print out number of people tested positive per zip code.
given an input date, print out names of people who are considered new cases on that date. A new case means a person tested positive on that date but never tested positive before that date. For example, if the input is May 5th 2021, and John tested negative on May 3rd 2021 but positive on May 5th 2021, and Alice tested positive on May 5th 2021 but never tested before, then both John and Alice should be counted.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
