SQL - 01 Flashcards
What is the difference between a CPU Core and a CPU Thread?
A CPU core is the physical part of the CPU that performs the computing work. A thread, on the other hand, is a virtual component that manages tasks. Some CPUs use multi-threading to allow each core to handle multiple tasks simultaneously.
What is a CPU Core?
A CPU core is an individual processing unit within a computer’s central processing unit (CPU). It can independently execute computer instructions, allowing for more efficient processing of multiple tasks.
How does Multi-Core CPU differ from a Single-Core CPU?
A multi-core CPU has multiple cores, allowing it to perform multiple processes simultaneously, greatly improving performance over single-core CPUs, especially for multi-threaded applications.
What is a Virtual Core?
A virtual core, commonly known as a thread, is a subdivision of a physical CPU core. It allows a single core to execute multiple threads or tasks concurrently, enhancing the CPU’s multitasking capabilities.
How do Virtual Cores Work in CPUs?
Through a technology known as simultaneous multithreading (SMT), such as Intel’s Hyper-Threading, a single physical core is split into multiple virtual cores, allowing it to handle more than one instruction stream at a time.
What is the advantage of having Virtual Cores?
Virtual cores improve the efficiency of CPU resource utilization, allowing for better performance in multi-threaded applications and multitasking scenarios.
Do Virtual Cores double the performance of Physical Cores?
While virtual cores increase a CPU’s ability to handle multiple tasks, they do not double the performance. The performance gain depends on the nature of the tasks and the application’s ability to utilize multithreading.
How can you identify Virtual Cores in your system?
You can identify virtual cores in your system by checking the CPU specifications in the system settings or using system information tools. A CPU with SMT will show twice as many cores as the physical core count.
What is a Super Key?
A super key is a set of one or more columns (attributes) that can uniquely identify a record in a database table. It may contain additional attributes that are not necessary for unique identification.
What is a Primary Key?
A primary key is a specific type of super key. It’s a minimal set of columns that can uniquely identify each row in a table. Each table has a single primary key, and its values must be unique and not null.
What is a Unique Key?
A unique key is similar to a primary key in that it must contain unique values. The difference is that a table can have multiple unique keys, and unlike primary keys, they can contain null values (unless otherwise specified).
How is a Super Key different from a Primary Key?
While both super keys and primary keys uniquely identify records, super keys may contain additional attributes that aren’t necessary for uniqueness. A primary key is a minimal super key, meaning it has no unnecessary attributes.
When is a Unique Key used over a Primary Key?
A unique key is used when there is a need to enforce uniqueness on a column that is not the primary key. For instance, you might use it for a secondary identifier that must be unique, like an email address or employee ID.
What is a Candidate Key?
A candidate key is a set of one or more fields/columns in a table that can uniquely identify a record. Any candidate key can potentially become a primary key.
How does a Candidate Key differ from a Primary Key?
While both candidate and primary keys uniquely identify records in a table, the primary key is the chosen candidate key for that purpose. Other candidate keys become alternate keys.
Can a table have more than one Candidate Key?
Yes, a table can have multiple candidate keys, each capable of uniquely identifying a record. Only one of these is selected as the primary key.
What are the characteristics of a Candidate Key?
A candidate key must contain unique values and cannot have null values. Each value in the key must uniquely identify a row in the table.
Why is it important to identify Candidate Keys in a database?
Identifying candidate keys is important for ensuring data integrity and optimal database design. It helps in selecting the most suitable primary key and understanding data relationships.
What is a Surrogate Key?
A surrogate key is an artificial or synthetic key used in a database table. It’s a unique identifier for each row that is not derived from application data.
How is a Surrogate Key different from a Natural Key?
A surrogate key is system-generated, like an auto-incrementing number, whereas a natural key is derived from existing data attributes that are meaningful within the application context.
Why are Surrogate Keys used in databases?
Surrogate keys are used because they provide a stable, unique identifier that doesn’t change as application data changes. They’re especially useful in complex databases with many relationships.
What are the benefits of using a Surrogate Key?
Benefits include simplicity, as they are usually simple numeric values, and stability, since they are not affected by changes in application data. They also enhance performance in joins and queries.
Can Surrogate Keys create any issues in database design?
While useful, surrogate keys can lead to an increase in space usage and might cause reliance on the database’s internal mechanism, making database portability more complex.
What is a Foreign Key?
A foreign key is a field (or collection of fields) in one table that uniquely identifies a row of another table. It’s used to establish and enforce a link between the data in two tables.