0

SQL, someone can help me please

There are new employees that need to be added to the Employees table. Here is their data: Firstname: Wang Lastname: Lee Salary1900 The Employees table has an identity column called id, which is set to AUTO_INCREMENT. Add the data to the table, then select the id, firstname, lastname and salary columns sorted by the id column in descending order. INSERT INTO Employees ( id INT AUTO_INCREMENT, firstname, lastname, salário) VALUES ( ‘Wang’, ‘Lee’, 1900); SELECT * FROM Employees ORDER BY id DESC

27th Feb 2024, 1:46 AM
Bruna Yukimy Hada
Bruna Yukimy Hada - avatar
15 Answers
+ 2
INSERT INTO Employees (firstname, lastname, "salário") VALUES ('Wang', 'Lee', 1900); add " " to your salàrio accent
27th Feb 2024, 1:35 PM
Salah Elazhary
Salah Elazhary - avatar
+ 1
Try this : CREATE TABLE Employees ( id INT AUTO_INCREMENT PRIMARY KEY, firstname VARCHAR(50), lastname VARCHAR(50), salário INT ); INSERT INTO Employees (firstname, lastname, salário) VALUES ('Wang', 'Lee', 1900); Verify your table and id column if exist and delet last item you add it
27th Feb 2024, 1:16 PM
Salah Elazhary
Salah Elazhary - avatar
+ 1
To insert the new employee data into the Employees table and then select the specified columns sorted by the id column in descending order, you can use the following SQL commands: ```sql -- Insert new employee data INSERT INTO Employees (firstname, lastname, salary) VALUES ('Wang', 'Lee', 1900); -- Select id, firstname, lastname, and salary columns sorted by id in descending order SELECT id, firstname, lastname, salary FROM Employees ORDER BY id DESC; ``` This will first insert the new employee data into the Employees table and then retrieve the id, firstname, lastname, and salary columns for all employees, sorted by the id column in descending order.
27th Feb 2024, 5:51 PM
Rohit Krishna
Rohit Krishna - avatar
0
I try this. And the error says that the table doesnt have the column id
27th Feb 2024, 1:09 PM
Bruna Yukimy Hada
Bruna Yukimy Hada - avatar
0
O erro agora O código apresenta dois erros: o primeiro está relacionado ao uso da palavra-chave "AUTO_INCREMENT", que não é reconhecida pelo SQL padrão e deve ser substituída por "SERIAL". O segundo erro ocorre durante a inserção de dados na tabela, pois o nome da coluna "salário" contém acento e não foi definido corretamente na criação da tabela. Deve ser alterado para "salario" ou entre aspas duplas "salário" para evitar conflitos com o SQL.
27th Feb 2024, 1:26 PM
Bruna Yukimy Hada
Bruna Yukimy Hada - avatar
0
So you solve it ??
27th Feb 2024, 1:29 PM
Salah Elazhary
Salah Elazhary - avatar
0
No
27th Feb 2024, 1:29 PM
Bruna Yukimy Hada
Bruna Yukimy Hada - avatar
0
The code presents two errors: the first is related to the use of the "AUTO_INCREMENT" keyword, which is not recognized by standard SQL and must be replaced by "SERIAL". The second error occurs when inserting data into the table, as the name of the "salary" column contains an accent and was not defined correctly when creating the table. It must be changed to "salario" or in double quotes "salário" to avoid conflicts with SQL.
27th Feb 2024, 1:29 PM
Bruna Yukimy Hada
Bruna Yukimy Hada - avatar
0
What's you envirment do you work in, oracl version ??
27th Feb 2024, 1:30 PM
Salah Elazhary
Salah Elazhary - avatar
0
Salah i have no idea is a test in the solo learn
27th Feb 2024, 1:35 PM
Bruna Yukimy Hada
Bruna Yukimy Hada - avatar
0
Bruna Yukimy Hada i am send you in private i will solve it probably probleme excution
27th Feb 2024, 1:38 PM
Salah Elazhary
Salah Elazhary - avatar
0
It is the class of identify - table constrainsts the course os intermediate SQL
27th Feb 2024, 1:39 PM
Bruna Yukimy Hada
Bruna Yukimy Hada - avatar
0
Ok thank you Salah Elazhary
27th Feb 2024, 1:40 PM
Bruna Yukimy Hada
Bruna Yukimy Hada - avatar
0
Thank you gus It worked out
27th Feb 2024, 1:49 PM
Bruna Yukimy Hada
Bruna Yukimy Hada - avatar
0
Bruna Yukimy Hada you are welcome
27th Feb 2024, 1:52 PM
Salah Elazhary
Salah Elazhary - avatar