2021年4月8日星期四

How to display a table in terminal stored in sql file using MYSQL XAAMP?

I'm new to SQL and having trouble how I can see the view the table of the data I have created in the SQL file.

I have downloaded XAAMP to access mysql. Basically, I want to see a table in the terminal like show below:

enter image description here

First, through the terminal, I went into the path of sql folder and typed 'mysql -u root test < fileName.sql'. I am aware that typing this code allows the creation of the table.

Then, I typed 'mysql -u root' to access the main menu of the database, which shows like this:

enter image description here

I understand there's is a bunch of codes I can execute from here (ex. 'show databases;', 'use tests;'), but I'm having difficulty understanding which code to use to display a table I have created in the .sql file.

Here is my SQL code:

create table employee (    ID int NOT NULL AUTO_INCREMENT,    first_name varchar(100),    last_name varchar(100),    employee_id varchar(100),    phone_number varchar(100),    workstation varchar(100),    security_level varchar(100),    work_experience varchar(100),    sales_record varchar(100),    work_hour varchar(100),    gender varchar(100),      PRIMARY KEY (ID)  );    insert into employee (first_name, last_name, employee_id, phone_number, workstation, security_level, work_experience, sales_record, work_hour, gender) values ('michael',  'jackson', '12321', '778223123', 'West Wing','Level 3', '5 years', '240 sales/month', '8AM-5PM', 'male');  insert into employee (first_name, last_name, employee_id, phone_number, workstation, security_level, work_experience, sales_record, work_hour, gender) values ('jason',  'ahn', '32183', '2364382954', 'North-South Wing','Level 1', '2 years', '80 sales/month', '8AM-4PM', 'male');  insert into employee (first_name, last_name, employee_id, phone_number, workstation, security_level, work_experience, sales_record, work_hour, gender) values ('emily',    'carr', '12321', '7781232134', 'West Wing','Level 3', '5 years', '240 sales/month', '8AM-5PM', 'female');  insert into employee (first_name, last_name, employee_id, phone_number, workstation, security_level, work_experience, sales_record, work_hour, gender) values ('patrick', 'storm', '89231', '7782931232', 'South-West Wing','Level 2', '3 years', '118 sales/month', '8AM-5PM', 'male');  insert into employee (first_name, last_name, employee_id, phone_number, workstation, security_level, work_experience, sales_record, work_hour, gender) values ('elizabeth', 'young', '82931', '778291324', 'North Wing','Level 1', '6 years', '300 sales/month', '8AM-3PM', 'female');  insert into employee (first_name, last_name, employee_id, phone_number, workstation, security_level, work_experience, sales_record, work_hour, gender) values ('taylor', 'savier', '21321', '6045842132', 'West Wing','Level 2', '2 years', '140 sales/month', '8AM-6PM', 'female');  insert into employee (first_name, last_name, employee_id, phone_number, workstation, security_level, work_experience, sales_record, work_hour, gender) values ('jordan', 'johnson', '27312', '2364832912', 'East Wing','Level 3', '8 years', '210 sales/month', '8AM-4PM', 'male');  insert into employee (first_name, last_name, employee_id, phone_number, workstation, security_level, work_experience, sales_record, work_hour, gender) values ('elizabeth', 'young', '82931', '778291324', 'North Wing','Level 1', '6 years', '300 sales/month', '8AM-3PM', 'female');  insert into employee (first_name, last_name, employee_id, phone_number, workstation, security_level, work_experience, sales_record, work_hour, gender) values ('elizabeth', 'young', '82931', '778291324', 'North Wing','Level 1', '6 years', '300 sales/month', '8AM-3PM', 'female');  insert into employee (first_name, last_name, employee_id, phone_number, workstation, security_level, work_experience, sales_record, work_hour, gender) values ('elizabeth', 'young', '82931', '778291324', 'North Wing','Level 1', '6 years', '300 sales/month', '8AM-3PM', 'female');    
https://stackoverflow.com/questions/67015361/how-to-display-a-table-in-terminal-stored-in-sql-file-using-mysql-xaamp April 09, 2021 at 01:07PM

没有评论:

发表评论