Lecture 6,7: Python & SQL Flashcards

1
Q

What are the types of variables and the differences between them?
(with Ex from C)

A

1-Global variables: They are accessible outside any function throughout the whole program (While loop in C)
1-Local variables: They are only accessible inside the function and NOT anywhere outside the function (For loop in C)

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

What does a CSV file do?

A

it is a flat-file database where the data for each column (عمود) is separated by commas, and each row (صف) is on a new line, saved simply as a text file, which means it is completely portable and we can use it on nearly any operating system

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

Set is a built-in data structure in Python that represents

A

it basically ensures that all the values in our database are unique and not repeated

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

What is the difference when using the Lambda function?

A

Lambda function has no name which means we do not need to write “def” and the unique thing about it is that can have any number of arguments but only one expression, which is evaluated and returned as an immediate output.

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

Relational databases are?

A

they are programs that store data in files, but with additional data structures and interfaces that allow us to search and store data more efficiently.

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

The acronym (اختصار) CRUD means

A

it is the four types of basic operations when playing with data:
- CREATE
- READ
- UPDATE
- DELETE

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

What is database Schema? and how do developers use it?

A

it is a design that represents the storage (تخزين) of data. It describes both the organization of data and the relationships between tables.

Developers plan a database schema in advance so they know what types of data are necessary and how they will connect to each other.

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

What are the types of schema?

A

1-Logical
A logical database schema represents how the data is organized in terms of tables. It also explains how attributes from tables are linked together.

2-Physical
The physical database schema represents how data is stored on disk storage. In other words, it is the actual code that will be used to create the structure of your database including the database table names, column names, and data types.

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

Columns in SQL can also be called

A
  • PRIMARY KEY” like the “id” columns above that will be used to uniquely identify each row
  • FOREIGN KEY: like the “show_id” column that refers to another column in some other table
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

B-Tree is a common data structure in SQL that represents

A

it is like the binary tree we’ve seen in C but with more children, and with organized nodes such that we can search faster

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

What are the two main problems we might face when programming on SQL

A

1-SQL injection attack:
where someone can inject, or place, their own commands into inputs that it runs on our backend database

2-Race conditions:
when the shared data changed unintentionally by our code running on different devices or servers at the same time.

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