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
16 Antworten
+ 2
INSERT INTO Employees (firstname, lastname, "salário") VALUES ('Wang', 'Lee', 1900); add " " to your salàrio accent
+ 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
+ 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.
0
I try this. And the error says that the table doesnt have the column id
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.
0
So you solve it ??
0
No
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.
0
What's you envirment do you work in, oracl version ??
0
Salah i have no idea is a test in the solo learn
0
Bruna Yukimy Hada i am send you in private i will solve it probably probleme excution
0
It is the class of identify - table constrainsts the course os intermediate SQL
0
Ok thank you Salah Elazhary
0
Thank you gus
It worked out
0
Bruna Yukimy Hada you are welcome