MySQL Basic Queries Flashcards

1
Q

What is the first line of code upon opening command prompt?

A

cd\ [enter]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the next command you will type after changing directory (cd)?

A

cd xampp\mysql\bin [enter]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

After going to mysql bin, what comes after?

A

mysql –h localhost –p –u root [enter]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

If you wish to cancel a command, you may type __?

A

\C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

To display the mySQL or MariaDB version installed in your computer

A

select version(), current_date;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

To know the current date and time

A

select now();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

To know the user currently logged into the system

A

select user();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

To show the listing of the databases on the server

A

show databases;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

To select a database to use

A

use [database_name];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

To show the name of the currently selected database

A

select database();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

To show the tables on the currently selected
database

A

show tables;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

To show the structure of a particular table

A

describe [table_name];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

To view the users on the server

A

select user, host, password from mysql.user;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

To set user password

A

alter user [user_name] identified by [new_password];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

To create a new user account

A

create user [user_name] identified by [password];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

To remove a user

A

drop user [user_name];

17
Q

To create a database

A

create database [database_name];

18
Q

To delete a table

A

drop table [table_name];

19
Q

To insert a record into the table

A

insert into [table_name] values (…);