Question

In: Computer Science

What is wrong with the following INSERT commands: INSERT IN EMPLOYEE (EmployeeNumber, FirstName, LastName, Department, Position,...

  1. What is wrong with the following INSERT commands:

INSERT IN EMPLOYEE (EmployeeNumber, FirstName, LastName, Department, Position,

Supervisor, OfficePhone, EmailAddress) VALUES (5,'Alan','Adams','Human','H R 1',4,'360-285-8320','[email protected]');

INSERT INTO (EmployeeNumber, FirstName, LastName, Department, Position, Supervisor,

OfficePhone, EmailAddress) VALUES (5,'Alan','Adams','Human','H R 1',4,'360-2858320','[email protected]');

INSERT INTO EMPLOYEE (EmployeeNumber, FirstName, LastName, Department, Position,

Supervisor, OfficePhone, EmailAddress) VALUES ('Alan','Adams','Human','H R 1',4,'360285-8320','[email protected]');

INSERT INTO EMPLOYEE (EmployeeNumber, FirstName, LastName, Department, Position,

Supervisor, OfficePhone, EmailAddress) VALUES ('Alan','Adams','Human','H R 1',4,'360285-8320','[email protected]')

Solutions

Expert Solution

Solution :

1.

INSERT IN EMPLOYEE (EmployeeNumber, FirstName, LastName, Department, Position,

Supervisor, OfficePhone, EmailAddress) VALUES (5,'Alan','Adams','Human','H R 1',4,'360-285-8320','[email protected]');

This command is wrong as THERE is no IN keyword in sql it should be INTO.

Correct Sql command :

INSERT INTO EMPLOYEE (EmployeeNumber, FirstName, LastName, Department, Position,

Supervisor, OfficePhone, EmailAddress) VALUES (5,'Alan','Adams','Human','H R 1',4,'360-285-8320','[email protected]');

2.

INSERT INTO (EmployeeNumber, FirstName, LastName, Department, Position, Supervisor,

OfficePhone, EmailAddress) VALUES (5,'Alan','Adams','Human','H R 1',4,'360-2858320','[email protected]');

This is also wrong as you are not defining the table name in this so that's why it should give error in it.

Correct INSERT Command :

INSERT INTO EMPLOYEE(EmployeeNumber, FirstName, LastName, Department, Position, Supervisor,

OfficePhone, EmailAddress) VALUES (5,'Alan','Adams','Human','H R 1',4,'360-2858320','[email protected]');

3.

INSERT INTO EMPLOYEE (EmployeeNumber, FirstName, LastName, Department, Position,

Supervisor, OfficePhone, EmailAddress) VALUES ('Alan','Adams','Human','H R 1',4,'360285-8320','[email protected]');

This is also worng as the first column is EmployeeNumber and you are not passing any value in the values so it will also give error.

Correct sql command.

INSERT INTO EMPLOYEE (EmployeeNumber, FirstName, LastName, Department, Position,

Supervisor, OfficePhone, EmailAddress) VALUES (5,'Alan','Adams','Human','H R 1',4,'360285-8320','[email protected]');

4.

INSERT INTO EMPLOYEE (EmployeeNumber, FirstName, LastName, Department, Position,

Supervisor, OfficePhone, EmailAddress) VALUES ('Alan','Adams','Human','H R 1',4,'360285-8320','[email protected]')

in that query there is same error as you are not giving any value for employee number.

correct sql command is :

INSERT INTO EMPLOYEE (EmployeeNumber, FirstName, LastName, Department, Position,

Supervisor, OfficePhone, EmailAddress) VALUES (5,'Alan','Adams','Human','H R 1',4,'360285-8320','[email protected]').


Related Solutions

SQL ONLY- Given Tables- Employee (EmployeeID, FirstName, LastName, Address) Department (DeptNo, DepartmentName, City) DepartmentEmployee(DeptNo, EmployeeID, Position)...
SQL ONLY- Given Tables- Employee (EmployeeID, FirstName, LastName, Address) Department (DeptNo, DepartmentName, City) DepartmentEmployee(DeptNo, EmployeeID, Position) Project (ProjectNo, ProjectName, DeptNo) Project Team ( ProjectNo, EmployeeID, Role) MAKE THE QUERY FOR- 1. List the name and position of all the employee who works in the (DeptNo = ‘22C’). 2. List the total number of employees in each department for those departments with more than 5 employees. 3. List the project number, project name and the number of employees who worked on...
2. Consider the following relations: Doctor(SSN, FirstName, LastName, Specialty,YearsOfExperience, PhoneNum) Patient(SSN, FirstName, LastName, Address, DOB, PrimaryDoctor_SSN)...
2. Consider the following relations: Doctor(SSN, FirstName, LastName, Specialty,YearsOfExperience, PhoneNum) Patient(SSN, FirstName, LastName, Address, DOB, PrimaryDoctor_SSN) Medicine(TradeName, UnitPrice, GenericFlag) Prescription(Prescription Id, Date, Doctor_SSN, Patient_SSN) Prescription_Medicine(Prescription Id, TradeName, NumOfUnits) Note: The Medicine relation has attributes, trade name, unit price, and whether or not the medicine is generic (True or False). a. Determine the functional dependencies that exist in each table given above.
(C++) You are given a file consisting of students’ names in the following form: lastName, firstName...
(C++) You are given a file consisting of students’ names in the following form: lastName, firstName middleName. (Note that a student may not have a middle name.) Write a program that converts each name to the following form: firstName middleName lastName. Your program must read each student’s entire name in a variable and must consist of a function that takes as input a string, consists of a student’s name, and returns the string consisting of the altered name. Use the...
Using C++ Design a class named PersonData with the following member variables: lastName firstName address city...
Using C++ Design a class named PersonData with the following member variables: lastName firstName address city state zip phone and at a minimum the following member functions: A class constructor - which initializes all the member variables above a display() function - which ONLY displays all the person's data to the console Also write the appropriate accessor/mutator functions for the member variables Write a NewPersonData function. This is a stand-alone function that you can use in your main to generates...
describe what these mysql queries do 1.) select lastname, firstname, region, birthday from Members where birthday...
describe what these mysql queries do 1.) select lastname, firstname, region, birthday from Members where birthday in (select birthday from Members where email is not null) 2.) select Sales.Firstname As EmpFirst, Sales.Lastname as EmpLast, Sup.Firstname as SupFirst, Sup.Lastname as SupLast from Salespeople Sales inner join Salespeople Sup On Sales.Supervisor=Sup.SalesID 3.) select Region, Gender, Count(*) As Num from Members where Email is null group by region, gender 4.) select title from titles where not Genre = 'Jazz';
Write an AFTER Insert trigger for the following Employee table. Check Date of Birth and calculate...
Write an AFTER Insert trigger for the following Employee table. Check Date of Birth and calculate age. Update AGE field with calculated value in Employee_Info table Employee (Emp_ID int, DOB date) Employee_Info (Emp_ID int, Fname char, Lname char, Age int) Set variable Current_Date to CURDATE() Substract DOB from Current_Date to find Age
Write the following queries using the schema below Class (Number, Department, Term, Title) Student (Username, FirstName,...
Write the following queries using the schema below Class (Number, Department, Term, Title) Student (Username, FirstName, LastName, Year) Takes (Username, Department, Number, Term, Grade) [clarification] In Student, Year is an integer. A student can be a 2nd year student. In that case, Year value would be 2. For the Takes relation: ·         Grade is NA for current semester students ·         Username is foreign key to Student ·         (Department, Number, Term) is foreign key to Class a)       Write an SQL query that returns the Term...
Write the following queries using the schema below Class (Number, Department, Term, Title) Student (Username, FirstName,...
Write the following queries using the schema below Class (Number, Department, Term, Title) Student (Username, FirstName, LastName, Year) Takes (Username, Department, Number, Term, Grade) [clarification] In Student, Year is an integer. A student can be a 2nd year student. In that case, Year value would be 2. For the Takes relation: ·         Grade is NA for current semester students ·         Username is foreign key to Student ·         (Department, Number, Term) is foreign key to Class a)       Write an SQL query that returns the Term...
5.8  What’s wrong? State what is wrong in each of the following scenarios. (a) A parameter...
5.8  What’s wrong? State what is wrong in each of the following scenarios. (a) A parameter describes a sample. (b) Bias and variability are two names for the same thing. (c) Large samples are always better than small samples. (d) A sampling distribution is something generated by a computer.
What is wrong with the following definition of the correlation coefficient?
What is wrong with the following definition of the correlation coefficient? The correlation coefficient measures the strength and direction of the linear relationship between two variables Choose the correct answer below  A. The correlation coefficient is a measure that describes the direction of the relationship, but the strength of the relationship cannot be determined from the  B. The relationship between the two variables does not have to be linear to use the correlation coefficient  C. The correlation coefficient is a measure that describes the strength...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT