Skip to content
Advertisement

Tag: database

How to count and order correctly result from table

I have like this task currently: (sql fiddle: http://sqlfiddle.com/#!9/431723/49/0) It is necessary to form a SQL query to the files table which displays the number of files based on the success of the conversion and the presence of a good rating from registered / unregistered users. Output format: user_type (‘Visitor’ if id_user = NULL; ‘User’ otherwise), flag_converted, is_best_rating (‘1’ –

Is there a way to SELECT a database table using a variable?

I tried this statement: string query = “SELECT question FROM ‘” + GlobalVariables.dbQCode + “‘ WHERE [question_code] = ‘” + GlobalVariables.questionCode + “‘ “; and when I run the code it is giving me an exception: Syntax error in query. Incomplete query clause. Is there a way where I can use my variable? I want it to work because I

Making a table with a foreign key

I’m creating a SQL database in Oracle. I have created this table: And I tried creating a second table that has a foreign key referencing it: I get this error: ORA-00904: “LID”: invalid identifier 00904. 00000 – “%s: invalid identifier” Answer Defining a foreign key on a column doesn’t create the column. You need to create the column first and

Advertisement