Skip to content
Advertisement

Tag: postgresql

Get the number of the weekday from each date in a date list

DB-Fiddle Expected Results: I want go get the number of the weekday for each date in the table dates. Therefore, I tried to go with the solution from this question but could not make it work: How do I need to modify the query to get the expected result? Answer Get rid of the date keyword it is only needed

Deserialize Postgres ARRAY [@tags] to List with Dapper?

I’m using Dapper with Npsql (Postgres). I’m saving a serialized list of strings to one column called tags: which is resulting in {{first,second}} in the database. My question is how to read it back to the model? Do I need some special SQL, or can I use SELECT id, text, tags FROM account;? How can I dapper tell to deserialize

How to return deleted rows using jdbi?

How do I return the deleted rows using jdbi? For example, I’d like to do something like this: Answer Postgresql has a returning keyword… https://dbfiddle.uk/?rdbms=postgres_13&fiddle=25d284309745e40c8ea29945481d1aa2 You can then execute that query in the same way as you would a normal SELECT statement, and get a result set back; containing the records deleted.

SQL add a column with COUNT(*) to my query

I need to add a column with the content of this query : to this query : I tried adding a LEFT JOIN like that: with this line in my WHERE statement : and this line in my SELECT : but I get an error : I don’t understand how I could perform this action properly Answer To count something,

Query to get the Average of ONLY the first occurrences

I have 2 tables like these: Table Info Table A I need to take the first occurrence (occurrency_date ordered asc) of each Info and subtract from when the Info was created (created_date), after that take the average between them Something like this: I made many attempts but none were successful, how could I get this data? Answer If I understood

Advertisement