+ 1

SQL Question

*This is returning no errors or values. What am I doing wrong? BEGIN TRANSACTION; /* Create a table called emp */ CREATE TABLE emp(id int primary key, firstname varchar[50], lastname varchar[50], salary int, title text, Department varchar[50]); /* Create few records in this table */ INSERT INTO emp VALUES(1,'Tom', 'Marshall', 16000, 'Teller', 'Sales'); INSERT INTO emp VALUES(2,'Lucy', 'Lawless', 32000, 'Branch Manager', 'Sales'); INSERT INTO emp VALUES(3,'Frank', 'Underwood', 16000, 'Teller', 'Sales'); INSERT INTO emp VALUES(4,'Jane', 'The Virgin', 8000, 'Contractor', 'IT'); INSERT INTO emp VALUES(5,'Robert', 'Downey', 60000, 'Regional Manager', 'Sales'); INSERT INTO emp VALUES(6,'Tom', 'Jones', 16000, 'Teller', 'Sales'); INSERT INTO emp VALUES(7,'John', 'Taylor', 8000, 'Contractor', 'IT'); INSERT INTO emp VALUES(8,'Tom', 'Jones', 8000, 'Teller', 'Sales'); INSERT INTO emp VALUES(9,'Tommy', 'Jones', 2000, 'Contractor', 'IT'); INSERT INTO emp VALUES(10,'Tom', 'Jones', 1000, 'Teller', 'Sales'); COMMIT; /* Display all the records from the table */ Select FirstName, Min(salary) From emp Where Firstname LIKE '_T' And id IN (1,2,8,9);

18th Jul 2018, 9:41 PM
Christina Camacho
Christina Camacho - avatar
1 Respuesta
+ 4
There are no matches, as there is no employee whose second letter of name was capital T :) Change the LIKE parameter to 'T%' and observe the result ;)
18th Jul 2018, 9:51 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar