I have just started SQL and have some difficulties in terms of thinking in this language. I have now a task where I need to create a new column in a table with values from previous columns. This …
Tag: sql
Delete rows to keep only top values in a sql table
I am trying to have some product recommendations in my website. I have this table that i have generated but need to keep a limited amount of entries. The table consists of these columns (filling with …
Laravel Query. Obtain in Eloquent only totals > 0
I have this query: public static function totalByAgent(int $agentId) { return PropertyListing::select( DB::raw(‘SUM(property_listing.rental) as rental’), DB::raw(‘SUM(…
Replace Database field based on 2 different Table Conditions
I need to update the table based on email matching condition and need to know SQL query that can solve this problem. I have 2 tables “old_data” and “new_data” Old_data contains around 60,000 records …
avoid duplication when joining tables without unique id using foreign keys
I’m facing this issue where I don’t really know how to handle duplicate rows when joining two tables. I have two tables I’d like to join Value_x table : ID Campaign Value_x foo …
how remove special character and digits from a string but ignore white spaces
i tried to remove special characters and numeric number from string of sentence but it should ignore white spaces if there is a more than one it should replace with one SQL developer,oracle 11g …
How to access a previous value from a two way binded form input control?
Given the form here, I would like to be able to Update data in a SQL Table. In order to create the SQL query needed to make this happen I’ll have to pass in both the previous row’s value and the new …
operator does not exist: timestamp without time zone ~~* unknown ruby code
I am try to query users in the database when I do a search. However i am getting a specific error which is ‘operator does not exist: timestamp without time zone ~~* unknown’ In my database, the …
How to select only rows from a table one clumns value is more than b table count value in MySQL
Table A: id, name, school_code ——————- 1,David,10601 2,Jack,10602 3,John,10603 4,Hank,10602 5,Daisy,10601 6,Kelly,10602 7,May,10602 8,Mayme,10602 Table B: id, school_code,max_stu ——-…
ORA-00936: missing expression (sql-oracle)
I want to add 100 dollars to the old money, But tell me ORA-00936: missing expression create table sala( salary char(4)); insert into sala values(300); create or replace trigger update_sal …