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…
Tag: sql
Showing two different values depending on SESSION value in INNER JOIN
I have two different tables, one named users, and another named transactions. Transactions contains wallet1, wallet2, amount. Users contains user details such as firstname, lastname, and wallet. I am trying to display the corresponding first name and last name, depending on whether or not the SESSION_wallet i…
SQL: Update a table column with data in column retrieved from a view in same procedure
I’m trying to do a select and update within the same local procedure. The idea is to retrieve the number of ordered products from a specific order in the view (Produktantal) and then updating the stock numbers (antal) from the table “produktlager” with the data retrieved from the view. IR…
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…
Simple join query giving ORA 00933 on Oracle8i Release 8.1.7.0.1
Environment used – Following simple query is giving me an error : ORA-00933:SQL command not properly ended On SQL Developer 1.5.1 – Answer Oracle did not support the ANSI join syntax until version 9i. Also, Huy Ngo is correct that Oracle does not allow AS for table aliases. Try this code instead: