Question: Given a table events with the following structure: create table events ( sensor _ id integer not null, event _ type integer not null, value

Given a table events with the following structure:
create table events (
sensor_id integer not null,
event_type integer not null,
value float not null,
time timestamp not null,
):
Write an SQL query that returns a set of all sensors (sensors_id) with. the number of different event types (event_type) registered by each of them, ordered by sensor_id (in ascending order)
For example, given the following data:
sensor_id event_type value time
223.452014-02-1312:42:00
24-149.922014-02-1312:42:00
224.122014-02-1312:54:39
323.472014-02-1312:42:00
2324.542014-02-1313:32:36
your query should return the following rowset:
sensor_id types
23
31
the names of the columns in the rowset dont matter, but their order does

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!