{ "data": { "question": { "questionId": "3711", "questionFrontendId": "3374", "categoryTitle": "Database", "boundTopicId": 3007045, "title": "First Letter Capitalization II", "titleSlug": "first-letter-capitalization-ii", "content": "

Table: user_content

\n\n
\n+-------------+---------+\n| Column Name | Type    |\n+-------------+---------+\n| content_id  | int     |\n| content_text| varchar |\n+-------------+---------+\ncontent_id is the unique key for this table.\nEach row contains a unique ID and the corresponding text content.\n
\n\n

Write a solution to transform the text in the content_text column by applying the following rules:

\n\n\n\n

Return the result table that includes both the original content_text and the modified text following the above rules.

\n\n

The result format is in the following example.

\n\n

 

\n

Example:

\n\n
\n

Input:

\n\n

user_content table:

\n\n
\n+------------+---------------------------------+\n| content_id | content_text                    |\n+------------+---------------------------------+\n| 1          | hello world of SQL              |\n| 2          | the QUICK-brown fox             |\n| 3          | modern-day DATA science         |\n| 4          | web-based FRONT-end development |\n+------------+---------------------------------+\n
\n\n

Output:

\n\n
\n+------------+---------------------------------+---------------------------------+\n| content_id | original_text                   | converted_text                  |\n+------------+---------------------------------+---------------------------------+\n| 1          | hello world of SQL              | Hello World Of Sql              |\n| 2          | the QUICK-brown fox             | The Quick-Brown Fox             |\n| 3          | modern-day DATA science         | Modern-Day Data Science         |\n| 4          | web-based FRONT-end development | Web-Based Front-End Development |\n+------------+---------------------------------+---------------------------------+\n
\n\n

Explanation:

\n\n\n
\n", "translatedTitle": "首字母大写 II", "translatedContent": "

表:user_content

\n\n
\n+-------------+---------+\n| Column Name | Type    |\n+-------------+---------+\n| content_id  | int     |\n| content_text| varchar |\n+-------------+---------+\ncontent_id 是这张表的唯一主键。\n每一行包含一个不同的 ID 以及对应的文本内容。\n
\n\n

编写一个解决方案来根据下面的规则来转换 content_text 列中的文本:

\n\n\n\n

返回结果表同时包含原始的 content_text 以及根据上述规则修改后的文本。

\n\n

结果格式如下例所示。

\n\n

 

\n\n

示例:

\n\n
\n

输入:

\n\n

user_content 表:

\n\n
\n+------------+---------------------------------+\n| content_id | content_text                    |\n+------------+---------------------------------+\n| 1          | hello world of SQL              |\n| 2          | the QUICK-brown fox             |\n| 3          | modern-day DATA science         |\n| 4          | web-based FRONT-end development |\n+------------+---------------------------------+\n
\n\n

输出:

\n\n
\n+------------+---------------------------------+---------------------------------+\n| content_id | original_text                   | converted_text                  |\n+------------+---------------------------------+---------------------------------+\n| 1          | hello world of SQL              | Hello World Of Sql              |\n| 2          | the QUICK-brown fox             | The Quick-Brown Fox             |\n| 3          | modern-day DATA science         | Modern-Day Data Science         |\n| 4          | web-based FRONT-end development | Web-Based Front-End Development |\n+------------+---------------------------------+---------------------------------+\n
\n\n

解释:

\n\n\n
\n", "isPaidOnly": false, "difficulty": "Hard", "likes": 1, "dislikes": 0, "isLiked": null, "similarQuestions": "[]", "contributors": [], "langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": false, \"cangjie\": false}", "topicTags": [ { "name": "Database", "slug": "database", "translatedName": "数据库", "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": [ { "lang": "MySQL", "langSlug": "mysql", "code": "# Write your MySQL query statement below", "__typename": "CodeSnippetNode" }, { "lang": "MS SQL Server", "langSlug": "mssql", "code": "/* Write your T-SQL query statement below */", "__typename": "CodeSnippetNode" }, { "lang": "Oracle", "langSlug": "oraclesql", "code": "/* Write your PL/SQL query statement below */", "__typename": "CodeSnippetNode" }, { "lang": "Pandas", "langSlug": "pythondata", "code": "import pandas as pd\n\ndef capitalize_content(user_content: pd.DataFrame) -> pd.DataFrame:\n ", "__typename": "CodeSnippetNode" }, { "lang": "PostgreSQL", "langSlug": "postgresql", "code": "-- Write your PostgreSQL query statement below", "__typename": "CodeSnippetNode" } ], "stats": "{\"totalAccepted\": \"168\", \"totalSubmission\": \"216\", \"totalAcceptedRaw\": 168, \"totalSubmissionRaw\": 216, \"acRate\": \"77.8%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "{\"headers\":{\"user_content\":[\"content_id\",\"content_text\"]},\"rows\":{\"user_content\":[[1,\"hello world of SQL\"],[2,\"the QUICK-brown fox\"],[3,\"modern-day DATA science\"],[4,\"web-based FRONT-end development\"]]}}", "metaData": "{\"mysql\":[\"CREATE TABLE If not exists user_content (\\n content_id INT,\\n content_text VARCHAR(255)\\n)\"],\"mssql\":[\"CREATE TABLE user_content (\\n content_id INT,\\n content_text VARCHAR(255)\\n)\"],\"oraclesql\":[\"CREATE TABLE user_content (\\n content_id NUMBER,\\n content_text VARCHAR2(255)\\n)\"],\"database\":true,\"name\":\"capitalize_content\",\"pythondata\":[\"user_content = pd.DataFrame({\\n 'content_id': pd.Series(dtype='int'),\\n 'content_text': pd.Series(dtype='str')\\n})\"],\"postgresql\":[\"CREATE TABLE IF NOT EXISTS user_content (\\n content_id SERIAL PRIMARY KEY,\\n content_text VARCHAR(255)\\n);\\n\"],\"database_schema\":{\"user_content\":{\"content_id\":\"INT\",\"content_text\":\"VARCHAR(255)\"}}}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "CREATE TABLE If not exists user_content (\n content_id INT,\n content_text VARCHAR(255)\n)", "Truncate table user_content", "insert into user_content (content_id, content_text) values ('1', 'hello world of SQL')", "insert into user_content (content_id, content_text) values ('2', 'the QUICK-brown fox')", "insert into user_content (content_id, content_text) values ('3', 'modern-day DATA science')", "insert into user_content (content_id, content_text) values ('4', 'web-based FRONT-end development')" ], "enableRunCode": true, "envInfo": "{\"mysql\":[\"MySQL\",\"

\\u7248\\u672c\\uff1aMySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"

mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"

Oracle Sql 11.2.<\\/p>\"],\"pythondata\":[\"Pandas\",\"

Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\"

PostgreSQL 16<\\/p>\"]}", "book": null, "isSubscribed": false, "isDailyQuestion": false, "dailyRecordStatus": null, "editorType": "CKEDITOR", "ugcQuestionId": null, "style": "LEETCODE", "exampleTestcases": "{\"headers\":{\"user_content\":[\"content_id\",\"content_text\"]},\"rows\":{\"user_content\":[[1,\"hello world of SQL\"],[2,\"the QUICK-brown fox\"],[3,\"modern-day DATA science\"],[4,\"web-based FRONT-end development\"]]}}", "__typename": "QuestionNode" } } }