Postgresql – Like query for comma separated numbers
I am trying to get data from a view which returns users name and tags (comma separated numbers). Now I want to get a user if it has a certain tag. My view returns this: id | name | tags…
I am trying to get data from a view which returns users name and tags (comma separated numbers). Now I want to get a user if it has a certain tag. My view returns this: id | name | tags…
I have this query that runs in Redshift: Select A.* From TableA A join TableB B on A.Col like B.Pattern Where the Pattern column in TableB looks like: ('%foo%', '%bar%', ...) TableB has hundreds of pattern rules and is used…
I come back with utf8mb4 character issues. I'm using mariadb Server version: 10.3.37-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04 on a local machine with Linux Mint 20.3. Here is a test table: CREATE TABLE chartable ( k1 VARCHAR(5) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; INSERT…
I am creating a movie database and I have a query that finds movies by their ID and it is working. public function getMovieById($id) { $query = "SELECT * FROM movies WHERE id = ?"; $paramType = "i"; $paramValue =…
I have a table with two columns item_name, value where item_names looks like "abracadabra_prefix.tag_name". And I need to select rows with tag_names from a list that doesn't have a prefix. Should be somthing like: tag_names = ['f1', 'k500', '23_g'] SELECT…
I have a database of many thousands of companies. The issue I have is that some of these employers are duplicates - however - they don't have exactly the same name (otherwise this would be quite easy to solve). So…
Im making a filter where you can select colors and select newest. It would filter them, but the order by doesn't work for some reason. I tried it this way. It outputs the colors that match the database table, but…
Write an SQL query to report the patient_id, patient_name all conditions of patients who have Type I Diabetes. Type I Diabetes always starts with DIAB1 prefix. +--------------+---------+ | Column Name | Type | +--------------+---------+ | patient_id | int | |…
Here is the query to find the address from a table where it matches to variable $fromCity, $fromCity= "324 West Gore Street, Orlando, FL 32806, USA"; $sql = "SELECT * FROM vendor_info WHERE mailing_address LIKE '$fromCity'"; $em = $this->getDoctrine()->getManager(); $stmt…
Database: PostgresSQL PostgreSQL 12.11 (Ubuntu 12.11-0ubuntu0.20.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit RAM : 8 GB Processor : i7 4510U (dual core 2 Ghz) I would to like to optimized below query select a.gender from "employees" as…