mysql : group by column (show column with higer value)
i have some rows on "MENU" table id, shop, size 1, 1 , 3 2, 1 , 8 3, 2 , 5 i need to show 1 row for each shop so if shop id is same then show the…
i have some rows on "MENU" table id, shop, size 1, 1 , 3 2, 1 , 8 3, 2 , 5 i need to show 1 row for each shop so if shop id is same then show the…
I am using Postgresql 13 and I have a table that looks something like this: event_id timestamp 1 2022-11-28 00:00:00 1 2022-11-28 00:00:10 2 2022-11-28 00:00:20 2 2022-11-28 00:00:30 2 2022-11-28 00:00:40 3 2022-11-28 00:00:50 3 2022-11-28 00:01:10 1 2022-11-28…
Hey I need some help with sql query I have this data count Timestamp 1 10:05 2 10:06 3 10:07 1 10:08 2 10:09 3 10:10 I would like to obtain for each timestamp the total of count until that…
I should somehow convert data type to easily insert into table with datetime format. From 2022-11-28T12:18:46.534919023Z To 2022-11-28 12:18:46 BTW using PostgreSQL. Any ideas how to do it?
Field | Type | Null | Key | Default | Extra | Student_id | int | NO | PRI | NULL | auto_increment As I need when I insert data in table its auto increment automatically insert value but when…
The following codes gives the total duration that a light has been switched on. CREATE TABLE switch_times ( id SERIAL PRIMARY KEY, is1 BOOLEAN, id_dec INTEGER, label TEXT, ts TIMESTAMP WITH TIME ZONE default current_timestamp ); CREATE VIEW makecount AS…
I Am trying to write one query. Below is the query ritten till now. @Query(value = "select cn from CapNumber cn " + "WHERE (:#{#request.number} = '' OR cn.number LIKE CONCAT('%',:#{#request.number},'%')) " + "AND (:#{#request.name} IS '' OR cn.name LIKE…
I have a requirement to insert new records and delete this record 3 months after created date. I will create a new table. I want that query will create the table as well as auto delete the records which are…
I have a Products table where prices of products are updated every day. eff_date product_id price 2022-11-25 P1 150 2022-11-25 P2 75.8 2022-11-25 P3 2.9 2022-11-26 P1 180.5 2022-11-26 P2 77 2022-11-26 P4 13.92 But sometimes not all products will…
I have a table called "employment" which looks like if the boss column is empty it means he/she is the "CEO" and if he/she manages one another under boss column it means "Manager" else it's "Worker" Finally it should look…