{"id":23437891,"url":"https://github.com/sanam2405/sql","last_synced_at":"2026-01-21T04:32:48.087Z","repository":{"id":178186470,"uuid":"661163592","full_name":"sanam2405/SQL","owner":"sanam2405","description":"Learning Structured Query Language","archived":false,"fork":false,"pushed_at":"2023-07-04T07:48:51.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T19:38:14.083Z","etag":null,"topics":["sql"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sanam2405.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-02T01:53:32.000Z","updated_at":"2023-11-15T17:15:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"971b5b30-8d60-4d96-b591-d47b5be1e648","html_url":"https://github.com/sanam2405/SQL","commit_stats":null,"previous_names":["sanam2405/sql"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sanam2405/SQL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanam2405%2FSQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanam2405%2FSQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanam2405%2FSQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanam2405%2FSQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanam2405","download_url":"https://codeload.github.com/sanam2405/SQL/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanam2405%2FSQL/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28626244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T02:47:06.670Z","status":"ssl_error","status_checked_at":"2026-01-21T02:45:44.886Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sql"],"created_at":"2024-12-23T14:38:57.783Z","updated_at":"2026-01-21T04:32:48.069Z","avatar_url":"https://github.com/sanam2405.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQL\nLearning Structured Query Language\n\n\n## Methods\n\n- Check if an expression returns NULL\n```console\n    IFNULL(\u003cexpression\u003e,\u003calternate_value\u003e)\n```\n\n- Limit the number of results printed on firing a given query\n```console\n    LIMIT \u003coffset\u003e,\u003cvalues_taken\u003e\n```\n- Find the difference between two dates\n```console\n    DATEDIFF(\u003cfirst_date\u003e,\u003csecond_date\u003e)\n```\n\n- Match a Regular Expression or REGEX \n```console\n    LIKE \u003cregular_expression\u003e\n```\n\n- Concatenate the results of a query into a single row\n```console\n    GROUP_CONCAT(\u003cquery_returning_multiple_row_values\u003e)\n```\n\n- Find the unique or distinct values across all the rows of a column \n```console\n    DISTINCT \u003ccolumn_name\u003e\n```\n\n- Group multiple similar rows of a particular column\n```console\n    GROUP BY \u003ccolumn_name\u003e\n```\n\n- Order the output by ascending or descending order on firing a given query\n```console\n    ORDER BY \u003ccolumn_name\u003e DESC \n```\n\n- Specify conditions to query rows from a table \n```console\n    WHERE \u003cconditions\u003e\n```\n\n- Specify conditions to query groups from a table, after GROUP BY has been applied \n```console\n    HAVING \u003cconditions\u003e\n```\n\n- Extract a substring. 1-based indexing is followed in MySQL\n```console\n    SUBSTR(\u003cstring\u003e,\u003cbeginning_index\u003e,\u003cnumber_of_characters_to_be_extracted\u003e)\n    SUBSTR(\u003cstring\u003e,\u003cbeginning_index\u003e)              \n```\n\n- Concatenate strings and varchars\n```console\n    CONCAT(\u003cfirst_substring\u003e,\u003csecond_substring\u003e)\n```\n\n- Change to upper case\n```console \n    UPPER(\u003cstring\u003e)\n```\n\n- Change to lower case\n```console\n    LOWER(\u003cstring\u003e)\n```\n\n- Check a value against multiple rows from a subquery\n```console\n    IN(\u003cconditions\u003e)\n```\n\n- Switch-Case Statement\n```console\n    CASE\n    WHEN \u003cconditions\u003e THEN \u003cactions\u003e\n    WHEN \u003cconditions\u003e THEN \u003cactions\u003e\n    ELSE \u003cactions\u003e\n    END\n```\n\n- If Statement\n```console\n    IF(\u003cconditions\u003e,\u003cactions_if_conditions_satisfied\u003e,\u003cactions_in_else\u003e)\n```\n\n- Alter and Rename the Column name\n```console\n    ALTER \u003ctable_name\u003e\n    RENAME COLUMN \u003cold_column_name\u003e \u003cnew_column_name\u003e\n```\n\n- Update values in a Row, If the row is not present then nothing happens\n```console \n    UPDATE \u003ctable_name\u003e\n    SET \u003ccolumn_no = value\u003e, \u003ccolumn_no = value\u003e\n    WHERE \u003cprimary_key=row_id\u003e\n```\n\n- Insert values in a Row\n```console\n    INSERT INTO \u003ctable_name\u003e\n    (\n        \u003cfirst_column_name\u003e, \u003csecond_column_name\u003e\n\n    )\n    VALUES \n    (\n        \u003cfirst_value\u003e, \u003csecond_value\u003e\n    )\n```\n\n- Replace values in a Row, If the row is not present, then a new row is created. Replace = Insert+Update\n```console\n    REPLACE INTO \u003ctable_name\u003e\n    (\n        \u003cfirst_column_name\u003e, \u003csecond_column_name\u003e\n\n    )\n    VALUES \n    (\n        \u003cfirst_value\u003e, \u003csecond_value\u003e\n    )\n```\n\n- Rename the Table\n```console\n    ALTER TABLE \u003cold_table_name\u003e \n    RENAME TO \u003cnew_table_name\u003e\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanam2405%2Fsql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanam2405%2Fsql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanam2405%2Fsql/lists"}