How come the code in this project won't work?
irmat101 (0)

I am new to this language and don't really know what went wrong please look at this project and tell me what I did wrong.
Thank You

You are viewing a single comment. View All
Klokat (41)

I'm not entirely sure if this solves your problem but this runs with no errors.

.header on
.mode column

CREATE TABLE Languages(
  programinglanguage TEXT,
  file_plan TEXT
);


insert into Languages Values
	('html', 'TheDumbos home website has not been sent to google'),
	('python', 'ians own ai only person to view the project'),
	('kotlin', 'learning new languages and what they can do'),
	('c++', 'making an ai in a different language so easier to program'),
	('react', 'made an online app. "attached to my website by link"'),
	('python 2.7', 'maybe easier to make a search engine for ai');
.print 'programing languages and plans for them'
SELECT avg(programinglanguage) as avg_lang from Languages;

CREATE TABLE Scratch (
	views integer,
	name TEXT,
	version TEXT,
	view TEXT
);

insert into Scratch Values
	(7, 'Server Clicker', '1.13.1', 'this is the regular edition for this game "pc edition"'),
	(4, 'Server Clicker Mobile', '1.0', 'this is the mobile edition of the game'),
	(9, 'Decider Wheel', '1.2', 'this game helps you decide something or some stuff'),
	(12, 'Fish Attack', '1.2.1', 'this is a game where you are a fish and you have to protect your school and your colony'),
	(7, 'Circle Jump', '0.0.4', 'alpha/this is a game where you jump as a circle to get to the door'),
	(10, 'Time travel to year 3000', '0.1', 'this is a video-game for a special studio'),
	(6, 'Hope Orbit', '1.8.1', 'this is a game where you are a space bird and your trying to collect as much stars as possible'),
	(27, 'Scratchs 11 birthday', '0.1', 'this is a music player game/app');

.print 'Data from https://scratch.mit.edu'
SELECT avg(views) as avg_scratch
from Scratch

The first CREATE TABLE statement was missing parentheses and a semicolon.

The insert into Languages statement had some values that required 3 columns but there were only 2 defined with the previous statement. You could add a third column instead though.

For SELECT avg(program_lang) I changed it from program_lang to programinglanguage since that's the name of the column defined previously. Also semicolon.

For the CREATE TABLE Scratch statement I added the opening parenthesis and the missing semicolon. I also changed the version from integer to text since 1.13.1 is hardly an integer or a number even.

In the insert into Scratch Values statement I changed the version numbers into texts, added a couple of missing version numbers and the missing semicolon.

In last statement I changed it to select avg(views) instead of avg(scratch) since there's no scratch column. I'm not if this makes sense for your application though.

I hope I didn't forget to list anything here. Cheers