View the table definition using MySQL Workbench The salary of the employee is saved in the employee_salary column. If we do not specify any value for this column, MySQL inserts the “ A” as a default value The DEFAULT constraint has been created on this column. The data type of this column is varchar and length is 2. The grade of the employee is saved in the employee_garde column. If any row is updated in the tbldepartment table, the values in tblemployee updates automatically (ON UPDATE CASCADE), and the delete operation on the tbldepartment is restricted (ON DELETE RESTRICT) It’s a foreign key column that references the department_id column of the tbldepartment table. The department ID of the employee is saved in the employee_department_id column. You cannot insert a NULL value in the employee_name column The data type of the column is varchar(), and the length is 45. The Name of the employee is saved in the employee_name column. When you insert the data in the table, MySQL generates a sequential integer for the employee_id column It is a primary key of the table and has an auto-increment column hence you do not have to specify the value for this column explicitly. The ID of the Employee is saved in the employee_id column. See the following image:Įxecute the following query to create a new table named “ tblEmployees” in the “ Employees” database.įollowing are the details of the columns: In “ Setup New Connection” dialog box, provide the desired name of the connection, Hostname or IP Address of the MySQL database server, port, user name, and password and click on OK. To do that, open MySQL workbench, and on the Welcome screen, click on “ MySQL connections.” See the following image: If you want to create a table using MySQL Workbench, you must configure a new connection. ![]() A table can have more than one foreign key that references the primary key of different tables
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |