Skip to content

Tag: sql

Django Reverse Regex Match

I have a table (Django Model) and each row/object contains a regular expression that I should evaluate over a given input to filter relevant objects. Is there any Django ORM method to do this? In Postgre it will be: and the opposite of what I am searching for is: I know that evaluating the regular expressions…

SQL : IN operator vs multiple ORs

There is a behaviour I would like to understand for good. Query #1: Output : 504 Query #2 Output : 87 Query #3 Output : 0 I want to understand why am I getting zero in the third query. Based on this, the ( , ) is equivalent to a multiple OR. Isn’t this OR inclusive ? Answer the (

SQLite – TimeStamp to Date

I am trying to convert a timestamp to date in SQLite. But it give me always Null back, I try many solution I find out, but any solution works for me Here is my request : Thats my SQL script, if you want to try: Answer To expand on @forpas comment, SQLite does not have a TIMESTAMP data type, so

How to allow only numbers in (Oracle SQL)

I want to add a integrity constraint which only lets numeric data be added to the Unit_Price. Also, I have a email column in another table, how can I make it so a @ sign is required. Furthermore, if they dont enter email then it should be ‘ ‘unknow@gmail.con’ as default? Edit: Sorry the datatype was sup…

Oracle SQL closest date to given date

i have a table with a column for categories, date and price. Like this: So there are (almost) always two dates per group with two different prices. Now i need to write an SQL Statement to get the closest date per group to a given date(f.e. 05.05.2019). Group 1 has two dates an the SQL statement needs to Selec…

When to use right join or full outer join

I work with DB / SQL almost on a daily basis and the more I work with sql, the more I’m the opinion that there is no reason to use a right join or a full outer join. Let’s assume we have two tables: table1 and table2. Either I want to receive additional information for the rows in table1 so

MySQL Query WHERE [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question [Open this image][1] [1]: https://i.stack.imgur.com/GBQgV.png I try query, why cant one tech…