sql Flashcards

1
Q

what is the difference between sql and nosql

A

One of the differences is that sql has predefined schemas in which the tables have to be written out beforehand and if there are any changes needed to be made you have to alter the table whereas nosql you can add and change as many documents as you want without having to predefine anything.
Another difference is in sql the data is relational and being able to do things like join allows you to match data set by things like ids also offering data integrity to be able to use foreign keys to link users throughout different tables and traceback what they have done While NoSQL databases store data as individual objects that can include nested properties, if a piece of data like a name changes in one object, it might need to be manually updated in all instances where it appears. In contrast, with relational databases, a change at the top level, like in a primary table, can automatically reflect across all related records.
Lastly in sql you have a consistent language for querying like looking up data in spreadsheets or card catalogs whereas in nosql the languages are very diverse and can use multiple different types of built in functions to search for data.

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

What is inner join

A

inner join will select entries that have matching values on both tables

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

what is left join

A

left join will return all entries from the left table and any matched entries from the right otherwise null

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

what is right join

A

right join will return all entries from the right table and any matched entries from the left otherwise null

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

what is full join

A

full join returns all entries in both tables when there is a match otherwise null

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

what is cross join

A

cross join will return every possible combination of entries in both tables

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

what is sql

A

SQL stands for Structured Query Language. It’s used to communicate and interact with relational databases, allowing users to query, insert, update, and delete data.

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

what is dml

A

dml is data manipulation language, it is the process of making queries in sql to manipulate data

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

what is ddl

A

ddl is data definition language, it is the process of making queries to manage the table structures

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

what is dcl

A

dcl is data control language, it is the process of making queries to manage the permissions

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

what is tcl

A

tcl is transaction control language, it is the process of making queries to manage certain transactions

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

what is a primary key

A

a primary key is a way to uniquely identify each entry

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

what is a foreign key

A

a foreign key is a way to create relationships for multiple different tables

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

what is normalization

A

normalization is a way to be more organized when setting up you tables for instance if you have multiple customers then instead of storing there addresses on each order you would make a customers table to avoid data redundancy like what you see more often in a nosql environment.

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

what is an index

A

an index is added as a way to find entries quicker and speed up search queries

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

Describe a situation where you would use a GROUP BY clause.

A

GROUP BY clause in SQL is used when you want to gather rows that have the same value in specified columns into summary rows, like finding the number of employees in each department or the total sales for each customer.

17
Q

Difference between HAVING and WHERE clause.

A

WHERE: Filters data on the row level before any grouping or summing has been done.
HAVING: Filters data after it has been grouped and summed up.

18
Q

what is a subquery

A

A subquery, also known as a nested query or inner query, is a query that is embedded within another SQL statement. It can be used to retrieve data that will be used in the main query as a condition to further restrict the data that is retrieved.