What's new

Help Pa Check naman ng SQL code ko.

G I N E B R A

Forum Expert
Elite
Joined
Nov 18, 2017
Posts
6,064
Reaction
5,133
Points
2,107
Age
23
CREATE TABLE Multiple_Choice_Questions
(
Question varchar(255),
Correct_answer varchar(255),
Score int(255),
Choice1 varchar(255),
Choice2 varchar(255),
Choice3 varchar(255),
Choice4 varchar(255)
);

INSERT INTO Multiple_Choice_Questions (Question, Score) VALUES("What was the name of the first supersonic passenger airliner?", 1);
INSERT INTO Multiple_Choice_Questions (Question, Score) VALUES("In electronics, what does DC stand for?", 1);
INSERT INTO Multiple_Choice_Questions (Question, Score) VALUES("How many vertebrae does the average human possess?", 1);
INSERT INTO Multiple_Choice_Questions (Question, Score) VALUES("How many teeth does an ãdül† human have?", 1);
INSERT INTO Multiple_Choice_Questions (Question, Score) VALUES("Which famous British physicist wrote A Brief History of Time?", 1);

SELECT*FROM Multiple_Choice_Questions;



Ano po kayang mali o kaylangan idagdag pa help naman po sa willing tumulong PM ko nalang po yung link ng SQL code ko. Salamat po. Respect post po. Gof bless.
 

Attachments

sa an na part ts?

part 4 : States that need mo mag Execute ng insert into na statements
Table:
Should look like this\
1605742874645.png

Here's the default query structure for Insert:
"INSERT INTO multiple choice questions(Question, Correct_Answer, Score) VALUES (DEFAULT, 1, DEFAULT) "

For step 5: You need to perform Update Statements:
table should Look like this
1605742874453.png

Some Code Snippet for Your Guidance you can modify it accordingly you can set the Question as UniqueKey since there Should be no duplicates on the questions asked..

"UPDATE multiple choice questions SET Choice1 = ' ', Choice2 = ' ', Choice3 = ' ', Choice4 = ' ' WHERE Question = ' ' "


Take note that it is advice to use singleQoutes ( ' ' ) on string/varchar characters for your convenience.
 

Attachments

Last edited:
Bakit line 12-16 mo insert mo lang question tas point ang sabi sa task sainyo questions correct answer points
 
[XX='G I N E B R A, c: 507085, m: 1031988'][/XX] TS ung default value is ang syntax lng mag change value ka depende sa content na ilagay mo all i give you was the syntax sa insert and update pro need mo pa din e edit un accordingly.. samples lng un binigay ko para di ka ma spoon feed.. fill in the blank nlng un.. you need to do it by your self mahirap pag spoon feed nasa basic palang klayo ng sql.. later on pag mga advance query na baka ma hirapan ka lalo nat maraming klase ng database then nasa Relational Database kayo na basic palang at isa sa pinaka madaling e analyze kasi lahat ng table may relationship...
 
@G I N E B R A..TS ung default value is ang syntax lng mag change value ka depende sa content na ilagay mo all i give you was the syntax sa insert and update pro need mo pa din e edit un accordingly.. samples lng un binigay ko para di ka ma spoon feed.. fill in the blank nlng un.. you need to do it by your self mahirap pag spoon feed nasa basic palang klayo ng sql.. later on pag mga advance query na baka ma hirapan ka lalo nat maraming klase ng database then nasa Relational Database kayo na basic palang at isa sa pinaka madaling e analyze kasi lahat ng table may relationship...
Sorry po. Hahays. Nakakalito. Salamat po.
 
For number 4:
INSERT INTO @NameOfYourTable (Question, Correct_Answer, Score)
VALUES (@ Question, @Correct_Answer, @Score)


For Number 5:
UPDATE @nameOfYourTable
SET Choice1 = '@answerName',
Choice2 = '@NameChoice2',
Choice3 = '@NameChoice3',
Choice4 = '@NameChoice4'
WHERE Question = '@Question1_Name'



change all values na may" @"
 
Last edited by a moderator:
Back
Top