Skip to content

Conversation

@hussam-it-max
Copy link

No description provided.

@yunchen4 yunchen4 self-assigned this Aug 30, 2025
Copy link

@yunchen4 yunchen4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Hussam,
I didn't see your code for exercise 1. Could you please upload it and let me know on Slack when it is available? Thank you!

const selectCountriesOfContinent=`SELECT name FROM country WHERE continent='Europe';`;
const res3=await client.query(selectCountriesOfContinent);
console.log(res3.rows);
const selectCountriesOrderBysurfaceArea=`SELECT * DROM country ORDER BY surfacearea DESC;`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs rework: syntax error for SELECT * DROM country ORDER BY surfacearea DESC;

const selectcitiesNamesOfCountry=`SELECT name FROM city WHERE CountryCode='NLD';`;
const res5=await client.query(selectcitiesNamesOfCountry);
console.log(res5.rows);
const selectPopulationOfCity=`SELECT Population FROM city WHERE Name='Roterdam';`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another misspelling for city name SELECT Population FROM city WHERE Name='Roterdam';

const createInviteeTableQuery=`CREATE TABLE IF NOT EXISTS invitee(
invitee_no SERIAL PRIMARY KEY,
invitee_name VARCHAR(255) NOT NULL,
INVITEE_BY VARCHAR(255) NOT NULL);`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: better to keep the column names in the same case (preferably lower case).

const creatRoomTableQuery=`CREATE TABLE IF NOT EXISTS room(
room_no SERIAL PRIMARY KEY,
room_name VARCHAR(255) NOT NULL,
floor_number INT NOT NULL);`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: usually the floor number is not a big number. Depending on the floor range, you can use type SMALLINT. This way you can reduce the size of table.
You can check the range for the number types: https://www.postgresql.org/docs/current/datatype-numeric.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants