In the following table I have:
I am looking for an output like the following image, I have the code: SELECT weekday AS day,modulecode,hournumber FROM schedules GROUP BY hournumber
Hi, I'm new to mysql, I'm trying to create a table according to the following statement: Create a table STUDENTS with the columns: student number (integer with three digits, unsigned, filled with zeros and autoincremented), name, surname, address, ID . Set restrictions: student number is primary key; name, surnames, dni are not null, and dni does not admit repeated values.
At the moment I have this:
but when executing the table, it gives me the error Invalid default value for 'Nro_ALU'
CREATE TABLE ALUMNOS(
NRO_ALU TINYINT AUTO_INCREMENT DEFAULT 000,
NOMBRE VARCHAR(50) NOT NULL,
APELLIDOS VARCHAR(50) NOT NULL,
DIRECCION VARCHAR(50) ,
DNI VARCHAR(10) UNIQUE NOT NULL,
PRIMARY KEY (NRO_ALU)
)
ENGINE = InnoDB;
I am starting in the world of programming and I have just solved the following exercise.
Ingresar un número y mostrar la suma de los números que lo anteceden.
Al ingresar el 5 me da como resultado el 10
.
As I do so that by console when entering for example the 5
, it shows me , I 1+2+3+4 = 10
leave the code that I make.
int num, suma = 0;
Console.Write("Ingresa un número:");
num = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i < num; i++)
suma = suma + i;
Console.Write("La suma de los números que anteceden a el número: " + num + " es " + suma + ".");
Console.ReadKey();