MySQL Flashcards

1
Q

DISTINC

A

display a unique list of values. Let’s say we have a table named employees with the following columns: employee_id, first_name, last_name, and department. but you want only the departments.

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

union vs join

A

basically union will combine new rows and join will combine data into columns

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

What is MySQL ?

A

is a relational database.

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

Difference between MySQL and SQL

A

MySQL is a relational database while SQL is a standardized language for databases.

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

What are some advantages of MySQL

A

Flexibility , Power, Configuration and security.

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

What is a database

A

is a structured collection of data.A way to store data in a orderly maner

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

What does MySQL database contain

A

it containes tables wich contains rows. In the rows there are columns that contain data itself.

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

How can you interact with MySQL?

A

command line
GUI web interface
programming language

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

What is a Database Queries?

A

A request

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

What are some of the common MySQL commands?

A

ADD,CREATE , DELETE, DROP,INSERT

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

How do you create a database in MySQL?

A

CREATE DATABASE nameofdatabase;

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

How do you create a table using MySQL?

A

CREATE TABLE name_of_table (
author VARCHAR(128),
title VARCHAR(128);

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

How do you Insert Data Into MySQL?

A

INSERT INTO table_name (column1, …)
VALUES (value1, …);

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

How do you remove a column from a database?

A

ALTER TABLE table_name
DROP colum_name;

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

What is an index ? How you make an index

A

Index are used to achieve fast searches with the help of an index.
ALTER TABLE history
ADD INDEX(author(10));

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

. How to Delete specific Data From a MySQL Table?

A

In MySQL, the DELETE statement is used to delete records from a table:

DELETE
FROM table_name
WHERE column_name = value_name
15

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

Examples of numeric types

A

INT, FLOAT, DOUBLE

18
Q

What are the String Data Types in MySQL?

A

CHAR, TEXT

19
Q

What are the Temporal Data Types in MySQL?

A

DATE ,TIME,DATETIME

20
Q

How to add users in MySQL?

A

CREATE command

CREATE USER ‘testuser’ IDENTIFIED BY ‘ password’;

21
Q

What is BLOB in MySQL?

A

BLOB is an acronym that stands for a binary large object. It is used to hold pictures,videos etc.

22
Q

What is DDL , DML,DCL stands for ?

A

Data definition language - dealing with database schemas example create table comand
Data Manipulation language - includes select,insert
Data Control Language- grant revoke.

23
Q

What is a Join

A

is used to query data from two or more tables.

24
Q

What is a right join

A

it returns all rows from right table and only the rows from the left table where the condition is met.

25
Q

What is left join

A

it returns all rows from left table and only the rows from the right table where the condition is met.

26
Q

What is inner join

A

only returns the rows where the conditions are met between them.

27
Q

What is outer join

A

It returns all rows from both left and right with null values in the columns where there is no match

28
Q

What are common mysql function

A

NOWO : Returns the current date and time as a single value.
Concat (x,y): it concatenate two string values creating one single string.

29
Q

What is the difference between a char and varchar

A

char is fixed while varchar adjust the column and table length as required.

30
Q

What is a heap

A

is a temporary table stored in memory.

31
Q

What is the maximum limit of indexed columngs?

A

16

32
Q

What are different types of string used in MySQL

A

SET, BLOB,VARCHAR,TEXT,ENUM,CHAR

33
Q

Add column in MYSQL

A

ALTER TABLE table_name
ADD COLUMN column_name column_definiton
[FIRST|AFTER existing_column];

34
Q

Order of MySQL

A

Select
From
Join
where
Group by
Having
order
limit

35
Q

What are some commands in manipulating data

A

insert,update,delete

36
Q

What is a database schema ?

A

Blue print of how data is organized.
Blueprint of a table.

37
Q

Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. Your result cannot contain duplicates.

Input Format

The STATION table is described as follows:

A

SELECT DISTINCT CITY
FROM STATION
WHERE CITY LIKE ‘a%’
OR CITY LIKE ‘e%’
OR CITY LIKE ‘i%’
OR CITY LIKE ‘o%’
OR CITY LIKE ‘u%’;

38
Q

What is a wild card on MySQL

A

A wildcard character is a special character that can be used to represent one or more other characters in a string.
It can be % or _

39
Q

What is % in mysql

A

*When used at the beginning of a pattern: Matches any string that ends with the specified characters.

*When used at the end of a pattern: Matches any string that starts with the specified characters.

*When used both at the beginning and end of a pattern: Matches any string that contains the specified characters.

40
Q

What is _

A

Represents a single character.
Used within a pattern to match any single character in that position.
Example: ‘a_ _ _’ will match any four-letter word starting with ‘a’.

41
Q
A