File notes/code/sql/HW_CapstoneSol.sql changed (mode: 100644) (index 1c14b77..423d6b7) |
... |
... |
You can simply answer "True" or "False", or justify your reasoning (e.g. with co |
124 |
124 |
*/ |
*/ |
125 |
125 |
-- 1. Can a project uses multiple programming languages? |
-- 1. Can a project uses multiple programming languages? |
126 |
126 |
-- Yes. |
-- Yes. |
127 |
|
-- 2. Can a student be the leader of multiple |
|
|
127 |
|
-- 2. Can a student be the leader of multiple |
|
128 |
|
-- projects? |
128 |
129 |
-- Yes. |
-- Yes. |
129 |
|
-- 3. Can multiple projects have the same code name? |
|
|
130 |
|
-- 3. Can multiple projects have the same code name? |
130 |
131 |
-- Yes. |
-- Yes. |
131 |
|
-- 4. Could Claude simply enter NULL for the value |
|
132 |
|
-- project's code name, since he's undecided? |
|
133 |
|
-- No. |
|
134 |
|
-- 5. Can a project be created without project |
|
135 |
|
-- No. |
|
136 |
|
-- 6. Can we know who is working on a project |
|
137 |
|
-- its leader? |
|
138 |
|
-- No. |
|
|
132 |
|
-- 4. Could Claude simply enter NULL for the value |
|
133 |
|
-- of his pproject's code name, since he's undecided? |
|
134 |
|
-- No. |
|
135 |
|
-- 5. Can a project be created without project |
|
136 |
|
-- leader? |
|
137 |
|
-- No. |
|
138 |
|
--6. Can we know who is working on a project |
|
139 |
|
-- without being its leader? |
|
140 |
|
-- No. |
139 |
141 |
/* |
/* |
140 |
142 |
|
|
141 |
143 |
II. Relational Model (6 pts.) |
II. Relational Model (6 pts.) |
|
... |
... |
VALUES ( |
173 |
169 |
NULL); |
NULL); |
174 |
170 |
|
|
175 |
171 |
-- 2. Write a command that updates the code name of the |
-- 2. Write a command that updates the code name of the |
176 |
|
-- project ("Undecided", "9999999999999") to "VR in |
|
|
172 |
|
-- project ("Undecided", "9999999999999") to "VR in |
|
173 |
|
-- ER". |
177 |
174 |
UPDATE |
UPDATE |
178 |
175 |
PROJECT |
PROJECT |
179 |
176 |
SET CodeName = "VR in ER" |
SET CodeName = "VR in ER" |
|
... |
... |
WHERE CodeName = "Undecided" |
182 |
178 |
AND Leader = "9999999999999"; |
AND Leader = "9999999999999"; |
183 |
179 |
|
|
184 |
180 |
-- 3. Write a command that updates the graduation year of the |
-- 3. Write a command that updates the graduation year of the |
185 |
|
-- student whose id is "0987654321098" to 2024, and |
|
186 |
|
-- semester to "Fall". |
|
|
181 |
|
-- student whose id is "0987654321098" to 2024, and |
|
182 |
|
-- the semester to "Fall". |
187 |
183 |
UPDATE |
UPDATE |
188 |
184 |
STUDENT |
STUDENT |
189 |
185 |
SET GraduationYear = 2024, |
SET GraduationYear = 2024, |
|
... |
... |
SET GraduationYear = 2024, |
192 |
187 |
WHERE id = "0987654321098"; |
WHERE id = "0987654321098"; |
193 |
188 |
|
|
194 |
189 |
-- 4. Write a command that changes the STUDENT table to make |
-- 4. Write a command that changes the STUDENT table to make |
195 |
|
-- it impossible to enter NULL for the first name of |
|
196 |
|
-- student, without changing the primary key. |
|
|
190 |
|
-- it impossible to enter NULL for the first name of |
|
191 |
|
-- a student, without changing the primary key. |
197 |
192 |
ALTER TABLE STUDENT MODIFY FName VARCHAR(50) NOT NULL; |
ALTER TABLE STUDENT MODIFY FName VARCHAR(50) NOT NULL; |
198 |
193 |
|
|
199 |
194 |
-- 5. Write a command that changes the datatype of |
-- 5. Write a command that changes the datatype of |
200 |
|
-- GraduationYear to SMALLINT. |
|
|
195 |
|
-- GraduationYear to SMALLINT. |
201 |
196 |
ALTER TABLE STUDENT MODIFY GraduationYear SMALLINT; |
ALTER TABLE STUDENT MODIFY GraduationYear SMALLINT; |
202 |
197 |
|
|
203 |
198 |
-- 6. Write a command that adds an attribute "ReleaseDate" to |
-- 6. Write a command that adds an attribute "ReleaseDate" to |
204 |
|
-- the PROJECT table. |
|
|
199 |
|
-- the PROJECT table. |
205 |
200 |
ALTER TABLE PROJECT |
ALTER TABLE PROJECT |
206 |
201 |
ADD COLUMN ReleaseDate DATE; |
ADD COLUMN ReleaseDate DATE; |
207 |
202 |
|
|
208 |
203 |
-- 6.bis If you managed to write the previous command |
-- 6.bis If you managed to write the previous command |
209 |
|
-- correctly, write a command that sets the release |
|
210 |
|
-- the project ("Brick Break", "0123456789100") to |
|
211 |
|
-- of November 2022. |
|
|
204 |
|
-- correctly, write a command that sets the release |
|
205 |
|
-- date of the project ("Brick Break", "0123456789100") to |
|
206 |
|
-- the 26th of November 2022. |
212 |
207 |
UPDATE |
UPDATE |
213 |
208 |
PROJECT |
PROJECT |
214 |
209 |
SET ReleaseDate = DATE "20221126" |
SET ReleaseDate = DATE "20221126" |
|
... |
... |
WHERE CodeName = "Brick Break" |
221 |
211 |
AND Leader = "0123456789100"; |
AND Leader = "0123456789100"; |
222 |
212 |
|
|
223 |
213 |
-- 7. Write a command that makes it impossible for a student |
-- 7. Write a command that makes it impossible for a student |
224 |
|
-- to be the leader in more than one project |
|
225 |
|
-- (This command should return an error) |
|
226 |
|
-- ALTER TABLE PROJECT ADD UNIQUE (Leader); |
|
|
214 |
|
-- to be the leader in more than one project |
|
215 |
|
-- (This command should return an error) |
|
216 |
|
-- ALTER TABLE PROJECT ADD UNIQUE (Leader); |
File notes/lectures_notes.md changed (mode: 100644) (index bcac630..aa72ea4) |
... |
... |
Note that we were quite careless when we set-up our installation: |
2908 |
2908 |
- We did not impose any requirement on the root password of our installation. Using a good, secure, and unique password, should have been required / advised. |
- We did not impose any requirement on the root password of our installation. Using a good, secure, and unique password, should have been required / advised. |
2909 |
2909 |
- We left all the options on default, whereas a good, secure, installation, always fine-tune what is enabled and what is not. |
- We left all the options on default, whereas a good, secure, installation, always fine-tune what is enabled and what is not. |
2910 |
2910 |
- We chosed a very weak password for `testuser` that is common to all of our installation. |
- We chosed a very weak password for `testuser` that is common to all of our installation. |
|
2911 |
|
- Using the command `mysqldump -u testuser -ppassword` means that the password will be stored in the history of your command-line interface (that you should be able to access using `history` or `Get-History` for Powershell) and could be accessed by anyone having access to it. |
2911 |
2912 |
|
|
2912 |
2913 |
All of those are obvious security risks, and **make this installation unsafe to be a production environment**. |
All of those are obvious security risks, and **make this installation unsafe to be a production environment**. |
2913 |
2914 |
We will only use it as a testing / learning environment, but it is strongly recommended to: |
We will only use it as a testing / learning environment, but it is strongly recommended to: |