I have DB structure in which two table internal_marks and internal_mark_entries are there.
I need to write a sql query to find for each which entry is made and which entry is not made as programme wise.
for example
REGNO, SNAME, SUBJECTNAME, ENTRY1, ENTRY2, ENTRY3
101 Test SQL Y N N
In the above format.
Internal_marks table structure as follows.
CREATE TABLE `internal_marks` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`student_id` bigint unsigned NOT NULL,
`subject_id` bigint unsigned NOT NULL,
`subject_additional_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`exammonth_id` bigint unsigned NOT NULL,
`batch_id` bigint unsigned NOT NULL,
`final_internal_mark` int DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `internal_marks_student_id_foreign` (`student_id`),
KEY `internal_marks_subject_id_foreign` (`subject_id`),
KEY `internal_marks_exammonth_id_foreign` (`exammonth_id`),
KEY `internal_marks_batch_id_foreign` (`batch_id`),
CONSTRAINT `internal_marks_batch_id_foreign` FOREIGN KEY (`batch_id`) REFERENCES `batches` (`id`),
CONSTRAINT `internal_marks_exammonth_id_foreign` FOREIGN KEY (`exammonth_id`) REFERENCES `exam_months` (`id`),
CONSTRAINT `internal_marks_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`),
CONSTRAINT `internal_marks_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=196606 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
and internal_mark_entries
CREATE TABLE `internal_mark_entries` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`internalmarks_id` bigint unsigned NOT NULL,
`entry_id` int unsigned DEFAULT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`total_hours` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`attendent_hours` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`max_mark` int unsigned DEFAULT NULL,
`secured_mark` int unsigned DEFAULT NULL,
`display` enum('Y','N') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Y',
PRIMARY KEY (`id`),
KEY `internal_mark_entries_internalmarks_id_foreign` (`internalmarks_id`),
CONSTRAINT `internal_mark_entries_internalmarks_id_foreign` FOREIGN KEY (`internalmarks_id`) REFERENCES `internal_marks` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
I tried my best to write but i dont get it as entry wise please help me.