Page 1 of 1

[Solved] Create query to show clients from specified city

PostPosted: Thu Dec 05, 2019 8:07 am
by RosarioCarrillo
I have no idea what i am doing i have the next 4 days to do my project and its frustrating because i feel like I'm close to understanding and i do what i need to but then it doesn't work !!!! So i need to do a table my question is do i have to add a description to the table in the design mode. Also when i am doing the query i feel like i get it but then nothing i do works i just need the clients info for a specific city and how i do it on query only works until i run it then it shows me an empty table and it allows me to add info but only one record nothing more what can i do to fix it ?????

Re: I need help

PostPosted: Thu Dec 05, 2019 9:09 am
by keme
Don't fear the punctuation!

I assume that this is a school project. We will not do it for you, but if you give more details about the assignment, you may get sensible advice.

Also, if you share your "work in progress" with us, we can see where you have gone wrong. This enables us to provide even better advice. If it is a job assignment, it may contain confidential info. In that case, don't share. This is a public place.

Re: I need help

PostPosted: Thu Dec 05, 2019 10:20 am
by RosarioCarrillo
Basically what my professor is asking is to make two table for two different types of data and i did that.. But then he ask to do a query for one of the data that has client info and its asking to to make the query that only shows the clients only from a specific city

Re: I need help

PostPosted: Thu Dec 05, 2019 10:57 am
by floris v
You can use the "where" statement to list only the data from records thet meet the condition, like "where <field name> = value". You should be able to figure this out without help though.

Re: I need help

PostPosted: Thu Dec 05, 2019 11:07 am
by RosarioCarrillo
alright so when i put that in and this comes in

Attempt to insert null into a non-nullable column: column: Street table: Client in statement [INSERT INTO "Client" ( "Billed ","City ","Client Name ","Client Number","Paid") VALUES ( ?,?,?,?,?)]

Re: I need help

PostPosted: Thu Dec 05, 2019 11:09 am
by RosarioCarrillo
this what i have on my SQL

SELECT "Client Number" AS "Client Number", "Client Name " AS "Client Name ", "City " AS "City ", "Billed " AS "Billed ", "Paid" AS "Paid" FROM "Client" WHERE "City " = 'Where <Anderson> = Value'

Re: I need help

PostPosted: Thu Dec 05, 2019 11:22 am
by floris v
Try WHERE "City" = "New York". And check the syntax, and please intelligently read suggestions made here.

Re: I need help

PostPosted: Thu Dec 05, 2019 11:32 am
by keme
The "non nullable" messages typically occur when you have a primary key (value is always required for primary keys) and you don't specify a value for it, and also didn't set it to autovalue/autoincrement.

Re: I need help

PostPosted: Thu Dec 05, 2019 11:33 am
by RosarioCarrillo
how do i fix that? would i need to go back to the table and edit it there?

Re: I need help

PostPosted: Thu Dec 05, 2019 1:41 pm
by keme
RosarioCarrillo wrote:how do i fix that? would i need to go back to the table and edit it there?

It depends on how your table is set up. First determine what to fix, then we can talk about how.
  • Do you have a primary key (PK)?
    • What data type is it?
    • Did you set it up yourself, or was an "ID" PK created by default when you saved your table?
    • Do you explicitly assign a PK value in the query?
    • Is a value implicitly assigned (e.g. by autoincrement)?
  • Do you have other fields explicitly designated as "not null"?
    • Why?

Re: I need help

PostPosted: Thu Dec 05, 2019 3:23 pm
by Hagar Delest
keme wrote:Don't fear the punctuation!

Excellent. :lol:

I would add: please provide your topic a real title. If you're here, we bet you're seeking some help.
A descriptive title for posts helps others who are searching for solutions and increases the chances of a reply

Re: I need help

PostPosted: Thu Dec 05, 2019 5:36 pm
by RosarioCarrillo
Alright thank you I wouldn't be asking for help if I didn't need it I'll get all that info later right now I have to work thanks for all the help much appreciated!

Re: Create query to show clients from specified city

PostPosted: Fri Dec 06, 2019 6:47 am
by RosarioCarrillo
Im in college and when i ask my professro if im even doing it right if he can explain he just wont he gives me one worded responses and its frustrating.

Re: Create query to show clients from specified city

PostPosted: Fri Dec 06, 2019 7:03 am
by RosarioCarrillo
This is a quick update but im still stuck and i dont understand what i am doing wrong.

Re: Create query to show clients from specified city

PostPosted: Fri Dec 06, 2019 7:20 am
by RosarioCarrillo
So for primary key, when i started my table i picked my Client Number to have the primary key and all options are on TEXT VARCHAR . None of it is on NULL well i dont think it is . I dont know how to add a pk to query so im not sure if i did it or not. i I also dont know what is autoincreatment .

Re: Create query to show clients from specified city

PostPosted: Fri Dec 06, 2019 9:03 am
by RosarioCarrillo
So I had help from another source but thanks everyone for the help.

Re: Create query to show clients from specified city

PostPosted: Fri Dec 06, 2019 9:05 am
by RosarioCarrillo
https://youtu.be/mKCGJQTe5fs


The source i refrenced too.