1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[72077],{21314:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/tools/sql-query-builder",function(){return s(62916)}])},62916:(e,t,s)=>{"use strict";s.r(t),s.d(t,{__N_SSG:()=>x,default:()=>p});var a=s(37876),r=s(14232),n=s(60504),l=s(48230),i=s.n(l),o=s(5132),d=s(17319);let c={ecommerce:{name:"E-commerce Store",description:"å¨çº¿ååºæ°æ®åº",icon:"\uD83D\uDED2",tables:{users:{columns:["id","email","name","created_at","country","premium"],types:{id:"INT",email:"VARCHAR",name:"VARCHAR",created_at:"DATE",country:"VARCHAR",premium:"BOOLEAN"},sampleData:[{id:1,email:"[email protected]",name:"Alice Johnson",created_at:"2024-01-15",country:"USA",premium:!0},{id:2,email:"[email protected]",name:"Bob Smith",created_at:"2024-02-20",country:"UK",premium:!1},{id:3,email:"[email protected]",name:"Carol Davis",created_at:"2024-03-10",country:"Canada",premium:!0},{id:4,email:"[email protected]",name:"David Lee",created_at:"2024-03-25",country:"USA",premium:!1},{id:5,email:"[email protected]",name:"Emma Wilson",created_at:"2024-04-05",country:"Australia",premium:!0}]},products:{columns:["id","name","price","category","stock","rating"],types:{id:"INT",name:"VARCHAR",price:"DECIMAL",category:"VARCHAR",stock:"INT",rating:"DECIMAL"},sampleData:[{id:1,name:"Laptop Pro",price:1299.99,category:"Electronics",stock:45,rating:4.8},{id:2,name:"Wireless Mouse",price:29.99,category:"Electronics",stock:200,rating:4.5},{id:3,name:"Desk Chair",price:299.99,category:"Furniture",stock:30,rating:4.7},{id:4,name:"USB Cable",price:9.99,category:"Electronics",stock:500,rating:4.2},{id:5,name:"Standing Desk",price:599.99,category:"Furniture",stock:15,rating:4.9}]},orders:{columns:["id","user_id","product_id","quantity","order_date","status","total"],types:{id:"INT",user_id:"INT",product_id:"INT",quantity:"INT",order_date:"DATE",status:"VARCHAR",total:"DECIMAL"},sampleData:[{id:1,user_id:1,product_id:1,quantity:1,order_date:"2024-04-01",status:"delivered",total:1299.99},{id:2,user_id:2,product_id:2,quantity:2,order_date:"2024-04-05",status:"shipped",total:59.98},{id:3,user_id:1,product_id:3,quantity:1,order_date:"2024-04-10",status:"pending",total:299.99},{id:4,user_id:3,product_id:5,quantity:1,order_date:"2024-04-12",status:"delivered",total:599.99},{id:5,user_id:5,product_id:4,quantity:3,order_date:"2024-04-15",status:"shipped",total:29.97}]}}},saas:{name:"SaaS Platform",description:"SaaS åºç¨æ°æ®åº",icon:"\uD83D\uDCBC",tables:{companies:{columns:["id","name","plan","mrr","created_at","status"],types:{id:"INT",name:"VARCHAR",plan:"VARCHAR",mrr:"DECIMAL",created_at:"DATE",status:"VARCHAR"},sampleData:[{id:1,name:"Acme Corp",plan:"Enterprise",mrr:5e3,created_at:"2023-06-15",status:"active"},{id:2,name:"StartupXYZ",plan:"Pro",mrr:299,created_at:"2024-01-20",status:"active"},{id:3,name:"TechCo",plan:"Starter",mrr:99,created_at:"2024-02-10",status:"trial"},{id:4,name:"BizGroup",plan:"Pro",mrr:499,created_at:"2024-03-05",status:"active"},{id:5,name:"AgencyHub",plan:"Enterprise",mrr:8e3,created_at:"2023-12-01",status:"active"}]},users:{columns:["id","company_id","email","role","last_login","active"],types:{id:"INT",company_id:"INT",email:"VARCHAR",role:"VARCHAR",last_login:"DATE",active:"BOOLEAN"},sampleData:[{id:1,company_id:1,email:"[email protected]",role:"admin",last_login:"2024-04-15",active:!0},{id:2,company_id:1,email:"[email protected]",role:"user",last_login:"2024-04-14",active:!0},{id:3,company_id:2,email:"[email protected]",role:"admin",last_login:"2024-04-10",active:!0},{id:4,company_id:3,email:"[email protected]",role:"admin",last_login:"2024-03-20",active:!1},{id:5,company_id:4,email:"[email protected]",role:"user",last_login:"2024-04-12",active:!0}]},events:{columns:["id","user_id","event_type","event_date","metadata"],types:{id:"INT",user_id:"INT",event_type:"VARCHAR",event_date:"TIMESTAMP",metadata:"JSON"},sampleData:[{id:1,user_id:1,event_type:"login",event_date:"2024-04-15 09:30:00",metadata:'{"ip":"192.168.1.1"}'},{id:2,user_id:1,event_type:"feature_used",event_date:"2024-04-15 10:15:00",metadata:'{"feature":"reports"}'},{id:3,user_id:2,event_type:"login",event_date:"2024-04-14 14:20:00",metadata:'{"ip":"192.168.1.2"}'},{id:4,user_id:3,event_type:"upgrade",event_date:"2024-04-10 11:00:00",metadata:'{"from":"Starter","to":"Pro"}'},{id:5,user_id:5,event_type:"export",event_date:"2024-04-12 16:45:00",metadata:'{"format":"csv"}'}]}}},social:{name:"Social Network",description:"ç¤¾äº¤å¹³å°æ°æ®åº",icon:"\uD83D\uDC65",tables:{users:{columns:["id","username","followers","following","verified","joined_date"],types:{id:"INT",username:"VARCHAR",followers:"INT",following:"INT",verified:"BOOLEAN",joined_date:"DATE"},sampleData:[{id:1,username:"tech_guru",followers:12500,following:340,verified:!0,joined_date:"2022-03-15"},{id:2,username:"designer_pro",followers:8900,following:520,verified:!0,joined_date:"2022-06-20"},{id:3,username:"newbie_dev",followers:150,following:200,verified:!1,joined_date:"2024-01-10"}
1,{id:4,username:"startup_founder",followers:5400,following:890,verified:!0,joined_date:"2023-02-05"},{id:5,username:"content_creator",followers:25e3,following:120,verified:!0,joined_date:"2021-11-01"}]},posts:{columns:["id","user_id","content","likes","shares","created_at"],types:{id:"INT",user_id:"INT",content:"TEXT",likes:"INT",shares:"INT",created_at:"TIMESTAMP"},sampleData:[{id:1,user_id:1,content:"Just launched my new course!",likes:450,shares:89,created_at:"2024-04-15 10:30:00"},{id:2,user_id:2,content:"Check out this design tutorial",likes:320,shares:45,created_at:"2024-04-14 15:20:00"},{id:3,user_id:3,content:"Learning SQL is fun!",likes:12,shares:2,created_at:"2024-04-13 09:15:00"},{id:4,user_id:5,content:"Behind the scenes of my workflow",likes:1200,shares:340,created_at:"2024-04-12 18:00:00"},{id:5,user_id:4,content:"Fundraising tips for founders",likes:580,shares:120,created_at:"2024-04-11 12:45:00"}]},comments:{columns:["id","post_id","user_id","comment_text","created_at"],types:{id:"INT",post_id:"INT",user_id:"INT",comment_text:"TEXT",created_at:"TIMESTAMP"},sampleData:[{id:1,post_id:1,user_id:2,comment_text:"Congrats! Will definitely check it out",created_at:"2024-04-15 11:00:00"},{id:2,post_id:1,user_id:4,comment_text:"This looks amazing!",created_at:"2024-04-15 12:30:00"},{id:3,post_id:4,user_id:1,comment_text:"Super helpful, thanks for sharing",created_at:"2024-04-12 19:15:00"},{id:4,post_id:5,user_id:3,comment_text:"Just what I needed!",created_at:"2024-04-11 14:20:00"},{id:5,post_id:2,user_id:5,comment_text:"Great tutorial!",created_at:"2024-04-14 16:45:00"}]}}}},m={ecommerce:[{name:"é«ä»·å¼å®¢æ·",sql:"SELECT name, email, COUNT(*) as order_count, SUM(total) as total_spent\nFROM users\nJOIN orders ON users.id = orders.user_id\nGROUP BY users.id\nHAVING total_spent > 500\nORDER BY total_spent DESC;",description:"æ¾åºæ¶è´¹è¶
è¿$500ç客æ·"},{name:"çé产å",sql:"SELECT products.name, products.category, SUM(orders.quantity) as units_sold\nFROM products\nJOIN orders ON products.id = orders.product_id\nGROUP BY products.id\nORDER BY units_sold DESC\nLIMIT 5;",description:"ééå5ç产å"},{name:"å¾
å货订å",sql:"SELECT orders.id, users.name, products.name as product, orders.order_date\nFROM orders\nJOIN users ON orders.user_id = users.id\nJOIN products ON orders.product_id = products.id\nWHERE orders.status = 'pending'\nORDER BY orders.order_date DESC;",description:"ææå¾
å¤çç订å"},{name:"åºåé¢è¦",sql:"SELECT name, category, stock, price\nFROM products\nWHERE stock < 50\nORDER BY stock ASC;",description:"åºåä½äº50ç产å"}],saas:[{name:"MRR åæ",sql:"SELECT plan, COUNT(*) as customers, SUM(mrr) as total_mrr, AVG(mrr) as avg_mrr\nFROM companies\nWHERE status = 'active'\nGROUP BY plan\nORDER BY total_mrr DESC;",description:"æå¥é¤åææåº¦ç»å¸¸æ§æ¶å
¥"},{name:"æ´»è·ç¨æ·",sql:"SELECT users.email, companies.name, users.last_login\nFROM users\nJOIN companies ON users.company_id = companies.id\nWHERE users.active = true\nAND users.last_login >= '2024-04-01'\nORDER BY users.last_login DESC;",description:"æ¬ææ´»è·ç¨æ·"},{name:"è¯ç¨è½¬å",sql:"SELECT name, plan, mrr, created_at, status\nFROM companies\nWHERE status = 'trial'\nAND created_at <= '2024-03-01'\nORDER BY created_at ASC;",description:"éè¦è·è¿çè¯ç¨è´¦æ·"},{name:"åè½ä½¿ç¨ç»è®¡",sql:"SELECT event_type, COUNT(*) as event_count, COUNT(DISTINCT user_id) as unique_users\nFROM events\nWHERE event_date >= '2024-04-01'\nGROUP BY event_type\nORDER BY event_count DESC;",description:"æ¬æåè½ä½¿ç¨æ
åµ"}],social:[{name:"å½±ååæå",sql:"SELECT username, followers, following, verified\nFROM users\nORDER BY followers DESC\nLIMIT 10;",description:"ç²ä¸æ°å10çç¨æ·"},{name:"çé¨å
容",sql:"SELECT posts.content, users.username, posts.likes, posts.shares, posts.created_at\nFROM posts\nJOIN users ON posts.user_id = users.id\nORDER BY (posts.likes + posts.shares * 2) DESC\nLIMIT 10;",description:"æå欢è¿çå¸å"},{name:"äºå¨åæ",sql:"SELECT users.username, COUNT(comments.id) as comment_count, AVG(posts.likes) as avg_post_like
1s\nFROM users\nLEFT JOIN posts ON users.id = posts.user_id\nLEFT JOIN comments ON posts.id = comments.post_id\nGROUP BY users.id\nORDER BY comment_count DESC\nLIMIT 10;",description:"ç¨æ·äºå¨æ°æ®"},{name:"æ°ç¨æ·å¢é¿",sql:"SELECT joined_date, COUNT(*) as new_users\nFROM users\nWHERE joined_date >= '2024-01-01'\nGROUP BY joined_date\nORDER BY joined_date DESC;",description:"æ¯æ¥æ°ç¨æ·æ³¨å"}]},u=[{id:1,title:"SELECT - åºç¡æ¥è¯¢",difficulty:"Beginner",estimatedTime:"5 min",topics:["SELECT","*","Column names"],explanation:"`SELECT` è¯å¥ç¨äºä»æ°æ®åºè¡¨ä¸æ£ç´¢æ°æ®ã\n\n`*` è¡¨ç¤ºéæ©ææåãä½ ä¹å¯ä»¥æå®ç¹å®çååã",example:"SELECT * FROM users;",challenge:"SELECT name, email FROM users;",challengeDesc:"åªéæ© name å email å",icon:"\uD83D\uDCD6"},{id:2,title:"WHERE - è¿æ»¤æ°æ®",difficulty:"Beginner",estimatedTime:"8 min",topics:["WHERE","=",">","<","LIKE"],explanation:"`WHERE` åå¥ç¨äºè¿æ»¤æ»¡è¶³ç¹å®æ¡ä»¶çè¡ã\n\næ¯æè¿ç®ç¬¦ï¼`=`ï¼çäºï¼ã`>`ï¼å¤§äºï¼ã`<`ï¼å°äºï¼ã`>=`ã`<=`ã`LIKE`ï¼æ¨¡ç³å¹é
ï¼",example:"SELECT * FROM products WHERE price > 100;",challenge:"SELECT * FROM users WHERE country = 'USA';",challengeDesc:"æ¾åºæææ¥èªç¾å½çç¨æ·",icon:"\uD83D\uDD0D"},{id:3,title:"ORDER BY - æåºç»æ",difficulty:"Beginner",estimatedTime:"6 min",topics:["ORDER BY","ASC","DESC"],explanation:"`ORDER BY` ç¨äºå¯¹ç»æè¿è¡æåºã\n\n`ASC` = ååºï¼é»è®¤ï¼\n`DESC` = éåº",example:"SELECT * FROM products ORDER BY price DESC;",challenge:"SELECT name, price FROM products ORDER BY price ASC LIMIT 3;",challengeDesc:"æ¾åºä»·æ ¼æä½ç3个产å",icon:"\uD83D\uDCCA"},{id:4,title:"LIMIT - éå¶ç»ææ°é",difficulty:"Beginner",estimatedTime:"5 min",topics:["LIMIT","Pagination"],explanation:'`LIMIT` éå¶è¿åçè¡æ°ã\n\n常ç¨äºå页åè·å"Top N"ç»æã',example:"SELECT * FROM posts ORDER BY likes DESC LIMIT 10;",challenge:"SELECT username, followers FROM users ORDER BY followers DESC LIMIT 5;",challengeDesc:"æ¾ç¤ºç²ä¸æ°å5çç¨æ·",icon:"\uD83C\uDFAF"},{id:5,title:"COUNT & SUM - èå彿°",difficulty:"Intermediate",estimatedTime:"10 min",topics:["COUNT","SUM","AVG","MIN","MAX"],explanation:"èå彿°å¯¹å¤è¡æ°æ®è¿è¡è®¡ç®ï¼\n\n⢠`COUNT(*)` - ç»è®¡è¡æ°\n⢠`SUM(column)` - æ±å\n⢠`AVG(column)` - å¹³åå¼\n⢠`MIN/MAX(column)` - æå°/æå¤§å¼",example:"SELECT COUNT(*) as total_users, AVG(followers) as avg_followers FROM users;",challenge:"SELECT category, COUNT(*) as product_count, AVG(price) as avg_price FROM products GROUP BY category;",challengeDesc:"æç±»å«ç»è®¡äº§åæ°éåå¹³åä»·æ ¼",icon:"\uD83E\uDDEE"},{id:6,title:"GROUP BY - åç»èå",difficulty:"Intermediate",estimatedTime:"12 min",topics:["GROUP BY","HAVING"],explanation:"`GROUP BY` å°è¡åç»å¹¶å¯¹æ¯ç»åºç¨èå彿°ã\n\n`HAVING` ç¨äºè¿æ»¤åç»åçç»æï¼ç±»ä¼¼äº WHEREï¼ä½ç¨äºèåï¼ã",example:"SELECT category, COUNT(*) as count FROM products GROUP BY category HAVING count > 5;",challenge:"SELECT user_id, COUNT(*) as order_count FROM orders GROUP BY user_id ORDER BY order_count DESC LIMIT 5;",challengeDesc:"æ¾åºè®¢åæ°æå¤ç5ä¸ªç¨æ·",icon:"\uD83D\uDCE6"},{id:7,title:"JOIN - è¿æ¥è¡¨",difficulty:"Intermediate",estimatedTime:"15 min",topics:["INNER JOIN","LEFT JOIN","ON"],explanation:"`JOIN` ç¨äºæ ¹æ®ç¸å
³åç»åå¤ä¸ªè¡¨çæ°æ®ã\n\n⢠`INNER JOIN` - åªè¿å两表é½å¹é
çè¡\n⢠`LEFT JOIN` - è¿å左表ææè¡ï¼å³è¡¨ä¸å¹é
å为 NULL",example:"SELECT users.name, orders.order_date, orders.total\nFROM users\nINNER JOIN orders ON users.id = orders.user_id;",challenge:"SELECT users.name, products.name as product, orders.quantity\nFROM orders\nJOIN users ON orders.user_id = users.id\nJOIN products ON orders.product_id = products.id\nWHERE orders.status = 'delivered';",challengeDesc:"æ¾ç¤ºææå·²äº¤ä»è®¢åçç¨æ·å产åä¿¡æ¯",icon:"\uD83D\uDD17"},{id:8,title:"åæ¥è¯¢ - Subqueries",difficulty:"Advanced",estimatedTime:"18 min",topics:["Subquery","IN","EXISTS"],explanation:"åæ¥è¯¢æ¯åµå¥å¨å¦ä¸ä¸ªæ¥è¯¢ä¸çæ¥è¯¢ã\n\nå¯ç¨äº WHEREãFROM æ SELECT åå¥ä¸ã",example:"SELECT * FROM products\nWHERE price > (SELECT AVG(price) FROM products);",challenge:"SELECT name, email FROM users\nWHERE id IN (SELECT user_id FROM orders WHERE total > 500);",challengeDesc:"æ¾åºæè®¢åéé¢è¶
è¿$500çç¨æ·",icon:"\uD83C\uDF93"}];var x=!0;function p(){let{t:e}=(0,o.s)(),[t,s]=(0,r.useState)("builder"),[l,x]=(0,r.useState)("ecommerce"),[p,g]=(0,r.useState)("users"),[h,b]=(0,r.useState)(["*"]),[f,y]=(0,r.useState)([]),[N,j]=(0,r.useState)([]),[v,
1E]=(0,r.useState)({column:"",direction:"ASC"}),[_,w]=(0,r.useState)([]),[C,S]=(0,r.useState)(""),[R,O]=(0,r.useState)(""),[T,D]=(0,r.useState)(null),[k,L]=(0,r.useState)([]),[I,A]=(0,r.useState)(null),[M,B]=(0,r.useState)({}),[q,F]=(0,r.useState)(!1),[U,H]=(0,r.useState)("sql");(0,r.useEffect)(()=>{let e=localStorage.getItem("sqlQueryBuilder_history"),t=localStorage.getItem("sqlQueryBuilder_progress");e&&L(JSON.parse(e)),t&&B(JSON.parse(t))},[]),(0,r.useEffect)(()=>{"builder"===t&&Y()},[p,h,f,N,v,_,C,t]);let Y=()=>{let e="SELECT ";if(h.includes("*")||0===h.length?e+="*":e+=h.join(", "),e+="\nFROM ".concat(p),N.forEach(t=>{t.table&&t.onLeft&&t.onRight&&(e+="\n".concat(t.type," ").concat(t.table," ON ").concat(t.onLeft," = ").concat(t.onRight))}),f.length>0){let t=f.filter(e=>e.column&&e.value);t.length>0&&(e+="\nWHERE ",e+=t.map(e=>"".concat(e.column," ").concat(e.operator," ").concat("LIKE"===e.operator?"'%".concat(e.value,"%'"):"'".concat(e.value,"'"))).join(" AND "))}_.length>0&&(e+="\nGROUP BY ".concat(_.join(", "))),v.column&&(e+="\nORDER BY ".concat(v.column," ").concat(v.direction)),C&&(e+="\nLIMIT ".concat(C)),O(e+=";")},G=()=>{try{let e=[...c[l].tables[p].sampleData];f.forEach(t=>{t.column&&t.value&&(e=e.filter(e=>{let s=e[t.column],a=t.value;switch(t.operator){case"=":return s==a;case">":return parseFloat(s)>parseFloat(a);case"<":return parseFloat(s)<parseFloat(a);case">=":return parseFloat(s)>=parseFloat(a);case"<=":return parseFloat(s)<=parseFloat(a);case"LIKE":return s.toString().toLowerCase().includes(a.toLowerCase());default:return!0}}))}),v.column&&e.sort((e,t)=>{let s=e[v.column],a=t[v.column],r=s>a?1:s<a?-1:0;return"DESC"===v.direction?-r:r}),C&&(e=e.slice(0,parseInt(C))),!h.includes("*")&&h.length>0&&(e=e.map(e=>{let t={};return h.forEach(s=>{e.hasOwnProperty(s)&&(t[s]=e[s])}),t})),D(e);let t=[{id:Date.now(),sql:R,timestamp:new Date().toISOString(),scenario:l,resultCount:e.length},...k.slice(0,19)];L(t),localStorage.setItem("sqlQueryBuilder_history",JSON.stringify(t))}catch(e){D({error:e.message})}},P=e=>{O(e.sql),s("builder"),setTimeout(()=>G(),100)},J=e=>{O(e.sql),x(e.scenario)},Q=e=>{A(e),O(e.example),F(!0)},V=e=>{let t={...M,[e]:!0};B(t),localStorage.setItem("sqlQueryBuilder_progress",JSON.stringify(t))},W=c[l],X=W.tables[p],K=X.columns,z=Object.keys(M).filter(e=>M[e]).length;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.A,{seo:{title:"Free SQL Query Builder 2026 | Interactive SQL Tutorial & Practice",description:"Learn SQL with visual query builder and 8 interactive lessons. Build SELECT, JOIN, WHERE queries with real-time execution. Free SQL practice for beginners with e-commerce, SaaS, and social media databases!",keywords:"free sql query builder, learn sql online, interactive sql tutorial, sql practice, visual query builder, sql for beginners, sql join tutorial, database query tool 2026",canonicalUrl:"https://www.nxcode.io/tools/sql-query-builder"}}),(0,a.jsx)("div",{className:"min-h-screen bg-gradient-to-b from-gray-50 via-white to-gray-50",children:(0,a.jsxs)("div",{className:"container mx-auto px-4 pt-24 pb-16 max-w-7xl",children:[(0,a.jsxs)("div",{className:"text-center mb-12",children:[(0,a.jsx)(i(),{href:"/tools",className:"text-pink-600 hover:text-pink-700 text-sm font-medium mb-4 inline-flex items-center gap-2 transition-colors",children:"â Back to Tools"}),(0,a.jsx)("h1",{className:"text-5xl md:text-6xl font-bold text-gray-900 mb-4 bg-gradient-to-r from-pink-600 to-orange-500 bg-clip-text text-transparent",children:"Interactive SQL Tutorial"}),(0,a.jsx)("p",{className:"text-xl text-gray-600 max-w-3xl mx-auto leading-relaxed",children:"Learn SQL through hands-on practice with visual query building, real data, and 8 interactive lessons"}),z>0&&(0,a.jsxs)("div",{className:"mt-6 max-w-md mx-auto",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-sm text-gray-600 mb-2",children:[(0,a.jsx)("span",{children:"Learning Progress"}),(0,a.jsxs)("span",{className:"font-semibold",children:[z,"/",u.length," lessons"]})]}),(0,a.jsx)("div",{className:"h-2 bg-gray-200 rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-gradient-to-r from-pink-600 to-orange-500 transition-all duration-500",style:{width:"".concat(z/u.length*100,"%")}})})]})]}),(0,a.jsx)("div",{className:"flex justify-center mb-8",children:(0,a.jsxs)("div",{className:"inline-flex rounded-xl border-2 border-gray-200 p-1 bg-white shadow-sm",children:[(0,a.jsx)("button",{onClick:()=>s("builder"),className:"px-6 py-3 rounded-lg font-semibold transition-all ".concat("builder"===t?"bg-gradient-to-r from-pink-600 to-orange-500 text-white shadow-lg":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),children:"\uD83D\uDD27 Query Builder"}),(0,a.jsx)("button",{onClick:()=>s("templates"),className:"px-6 py-3 rounded-lg font-semibold transition-all ".concat("templates"===t?"bg-gradient-to-r from-pink-600 to-orange-500 text-white shadow-lg":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),children:"\uD83D\uDCCB Templates"}),(0,a.jsxs)("button",{onClick:()=>s("learning"),className:"px-6 py-3 rounded-lg font-semibold transition-all relative ".concat("learning"===t?"bg-gradient-to-r from-pink-600 to-orange-500 text-white shadow-lg":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),children:["\uD83C\uDF93 Learn SQL",z>0&&(0,a.jsx)("span",{className:"absolute -top-1 -right-1 bg-green-500 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center",children:z})]})]})}),(0,a.jsx)("div",{className:"mb-8",children:(0,a.jsxs)("div",{className:"flex items-center justify-center gap-4 flex-wrap",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Database Scenario:"}),Object.entries(c).map(e=>{let[t,s]=e;return(0,a.jsxs)("button",{onClick:()=>{x(t),g(Object.keys(s.tables)[0]),y([]),j([]),D(null)},className:"px-4 py-2 rounded-lg font-medium transition-all flex items-center gap-2 ".concat(l===t?"bg-gradient-to-r from-pink-600 to-orange-500 text-white shadow-md":"bg-white border-2 border-gray-200 text-gray-700 hover:border-pink-300"),children:[(0,a.jsx)("span",{className:"text-xl",children:s.icon}),s.name]},t)})]})}),"builder"===t&&(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-8",children:[(0,a.jsxs)("div",{className:"lg:col-span-3 space-y-6",children:[(0,a.jsxs)("div",{className:"bg-white rounded-2xl shadow-lg p-6 border border-gray-100",children:[(0,a.jsxs)("h2",{className:"text-xl font-bold text-gray-900 mb-4 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-2xl",children:"1ï¸â£"})," Select Table"]}),(0,a.jsx)("div",{className:"grid grid-cols-3 gap-3",children:Object.keys(W.tables).map(e=>(0,a.jsxs)("button",{onClick:()=>{g(e),b(["*"]),y([])},className:"px-4 py-3 rounded-xl border-2 font-medium transition-all hover:scale-105 ".concat(p===e?"border-pink-500 bg-pink-50 text-pink-700 shadow-md":"border-gray-200 text-gray-700 hover:border-gray-300"),children:["\uD83D\uDCCA ",e]},e))})]}),(0,a.jsxs)("div",{className:"bg-white rounded-2xl shadow-lg p-6 border border-gray-100",children:[(0,a.jsxs)("h2",{className:"text-xl font-bold text-gray-900 mb-4 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-2xl",children:"2ï¸â£"})," Select Columns"]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,a.jsxs)("label",{className:"flex items-center gap-2 px-4 py-2 rounded-lg border-2 border-gray-200 cursor-pointer hover:bg-gray-50 transition-all",children:[(0,a.jsx)("input",{type:"checkbox",checked:h.includes("*"),onChange:e=>{b(e.target.checked?["*"]:[])},className:"w-4 h-4 text-pink-600"}),(0,a.jsx)("span",{className:"font-semibold",children:"* (All)"})]}),K.map(e=>(0,a.jsxs)("label",{className:"flex items-center gap-2 px-4 py-2 rounded-lg border-2 cursor-pointer transition-all ".concat(h.includes(e)&&!h.includes("*")?"border-pink-500 bg-pink-50":"border-gray-200 hover:bg-gray-50"),children:[(0,a.jsx)("input",{type:"checkbox",checked:h.includes(e)&&!h.includes("*"),onChange:t=>{t.target.checked?b([...h.filter(e=>"*"!==e),e]):b(h.filter(t=>t!==e))},disabled:h.includes("*"),className:"w-4 h-4 text-pink-600"}),(0,a.jsx)("span",{className:"font-medium",children:e}),(0,a.jsx)("span",{className:"text-xs text-gray-500",children:X.types[e]})]},e))]})]}),(0,a.jsxs)("div",{className:"bg-white rounded-2xl shadow-lg p-6 border border-gray-100",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-xl font-bold text-gray-900 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-2xl",children:"3ï¸â£"})," Add Filters (WHERE)"]}),(0,a.jsx)("button",{onClick:()=>y([...f,{column:"",operator:"=",value:""}]),className:"px-4 py-2 bg-gradient-to-r from-pink-600 to-orange-500 text-white rounded-lg font-medium hover:shadow-lg transition-all",children:"+ Add Condition"})]}),0===f.length?(0,a.jsx)("p",{className:"text-gray-500 text-center py-6 border-2 border-dashed border-gray-200 rounded-lg",children:'No filters. Click "Add Condition" to filter results.'}):(0,a.jsx)("div",{className:"space-y-3",children:f.map((e,t)=>(0,a.jsxs)("div",{className:"flex gap-3 items-center bg-gray-50 p-3 rounded-lg",children:[t>0&&(0,a.jsx)("span",{className:"font-semibold text-gray-600",children:"AND"}),(0,a.jsxs)("select",{value:e.column,onChange:e=>{let s=[...f];s[t].column=e.target.value,y(s)},className:"flex-1 px-3 py-2 border-2 border-gray-300 rounded-lg focus:border-pink-500 focus:ring-2 focus:ring-pink-200",children:[(0,a.jsx)("option",{value:"",children:"Select column"}),K.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),(0,a.jsxs)("select",{value:e.operator,onChange:e=>{let s=[...f];s[t].operator=e.target.value,y(s)},className:"px-3 py-2 border-2 border-gray-300 rounded-lg focus:border-pink-500 focus:ring-2 focus:ring-pink-200",children:[(0,a.jsx)("option",{value:"=",children:"="}),(0,a.jsx)("option",{value:">",children:">"}),(0,a.jsx)("option",{value:"<",children:"<"}),(0,a.jsx)("option",{value:">=",children:">="}),(0,a.jsx)("option",{value:"<=",children:"<="}),(0,a.jsx)("option",{value:"LIKE",children:"LIKE"})]}),(0,a.jsx)("input",{type:"text",value:e.value,onChange:e=>{let s=[...f];s[t].value=e.target.value,y(s)},placeholder:"Value",className:"flex-1 px-3 py-2 border-2 border-gray-300 rounded-lg focus:border-pink-500 focus:ring-2 focus:ring-pink-200"}),(0,a.jsx)("button",{onClick:()=>y(f.filter((e,s)=>s!==t)),className:"p-2 text-red-600 hover:bg-red-50 rounded-lg transition-colors",children:"â"})]},t))})]}),(0,a.jsxs)("div",{className:"bg-white rounded-2xl shadow-lg p-6 border border-gray-100",children:[(0,a.jsxs)("h2",{className:"text-xl font-bold text-gray-900 mb-4 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-2xl",children:"4ï¸â£"})," Sort & Limit"]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:"Order By"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("select",{value:v.column,onChange:e=>E({...v,column:e.target.value}),className:"flex-1 px-3 py-2 border-2 border-gray-300 rounded-lg focus:border-pink-500 focus:ring-2 focus:ring-pink-200",children:[(0,a.jsx)("option",{value:"",children:"None"}),K.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),(0,a.jsxs)("select",{value:v.direction,onChange:e=>E({...v,direction:e.target.value}),className:"px-3 py-2 border-2 border-gray-300 rounded-lg focus:border-pink-500 focus:ring-2 focus:ring-pink-200",disabled:!v.column,children:[(0,a.jsx)("option",{value:"ASC",children:"â ASC"}),(0,a.jsx)("option",{value:"DESC",children:"â DESC"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:"Limit Rows"}),(0,a.jsx)("input",{type:"number",value:C,onChange:e=>S(e.target.value),placeholder:"e.g., 10",className:"w-full px-3 py-2 border-2 border-gray-300 rounded-lg focus:border-pink-500 focus:ring-2 focus:ring-pink-200"})]})]})]}),(0,a.jsxs)("div",{className:"bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900 rounded-2xl shadow-2xl p-6 text-white",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-xl font-bold flex items-center gap-2",children:[(0,a.jsx)("span",{children:"â¡"})," Generated SQL"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(R),alert("SQL å·²å¤å¶å°åªè´´æ¿ï¼")},className:"px-4 py-2 bg-white/10 hover:bg-white/20 rounded-lg text-sm font-medium transition-all backdrop-blur-sm",children:"\uD83D\uDCCB Copy"}),(0,a.jsxs)("select",{value:U,onChange:e=>H(e.target.value),className:"px-3 py-2 bg-white/10 hover:bg-white/20 rounded-lg text-sm font-medium transition-all backdrop-blur-sm border-0",children:[(0,a.jsx)("option",{value:"sql",children:"SQL"}),(0,a.jsx)("option",{value:"csv",children:"CSV"}),(0,a.jsx)("option",{value:"json",children:"JSON"})]}),(0,a.jsx)("button",{onClick:()=>
1{if(T&&!T.error&&0!==T.length){if("sql"===U){let e=new Blob([R],{type:"text/plain"}),t=URL.createObjectURL(e),s=document.createElement("a");s.href=t,s.download="query.sql",s.click()}else if("csv"===U){let e=new Blob([[Object.keys(T[0]).join(","),...T.map(e=>Object.values(e).join(","))].join("\n")],{type:"text/csv"}),t=URL.createObjectURL(e),s=document.createElement("a");s.href=t,s.download="results.csv",s.click()}else if("json"===U){let e=new Blob([JSON.stringify(T,null,2)],{type:"application/json"}),t=URL.createObjectURL(e),s=document.createElement("a");s.href=t,s.download="results.json",s.click()}}},disabled:!T||T.error||0===T.length,className:"px-4 py-2 bg-white/10 hover:bg-white/20 rounded-lg text-sm font-medium transition-all backdrop-blur-sm disabled:opacity-50 disabled:cursor-not-allowed",children:"\uD83D\uDCBE Export"})]})]}),(0,a.jsx)("pre",{className:"bg-black/40 p-4 rounded-xl overflow-x-auto backdrop-blur-sm border border-white/10",children:(0,a.jsx)("code",{className:"text-green-400 font-mono text-sm leading-relaxed",children:R})}),(0,a.jsxs)("button",{onClick:G,className:"mt-4 w-full px-6 py-4 bg-gradient-to-r from-green-500 to-emerald-500 text-white rounded-xl font-bold hover:shadow-2xl transition-all transform hover:scale-105 flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{children:"â¶"})," Execute Query"]})]}),T&&(0,a.jsxs)("div",{className:"bg-white rounded-2xl shadow-lg p-6 border border-gray-100",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-xl font-bold text-gray-900 flex items-center gap-2",children:[(0,a.jsx)("span",{children:"\uD83D\uDCCA"})," Query Results"]}),!T.error&&(0,a.jsxs)("span",{className:"px-3 py-1 bg-green-100 text-green-700 rounded-full text-sm font-semibold",children:[T.length," row",1!==T.length?"s":""]})]}),T.error?(0,a.jsx)("div",{className:"bg-red-50 border-l-4 border-red-500 p-4 rounded-lg",children:(0,a.jsx)("p",{className:"text-red-700 font-medium",children:T.error})}):0===T.length?(0,a.jsx)("div",{className:"bg-yellow-50 border-l-4 border-yellow-500 p-4 rounded-lg",children:(0,a.jsx)("p",{className:"text-yellow-700 font-medium",children:"No results found."})}):(0,a.jsx)("div",{className:"overflow-x-auto rounded-lg border border-gray-200",children:(0,a.jsxs)("table",{className:"min-w-full divide-y divide-gray-200",children:[(0,a.jsx)("thead",{className:"bg-gradient-to-r from-pink-50 to-orange-50",children:(0,a.jsx)("tr",{children:Object.keys(T[0]).map(e=>(0,a.jsx)("th",{className:"px-6 py-3 text-left text-xs font-bold text-gray-700 uppercase tracking-wider",children:e},e))})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:T.map((e,t)=>(0,a.jsx)("tr",{className:"hover:bg-gray-50 transition-colors",children:Object.values(e).map((e,t)=>(0,a.jsx)("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:"boolean"==typeof e?e?"â":"â":e},t))},t))})]})})]})]}),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"bg-white rounded-2xl shadow-lg p-6 border border-gray-100 sticky top-24",children:[(0,a.jsxs)("h2",{className:"text-lg font-bold text-gray-900 mb-4 flex items-center gap-2",children:[(0,a.jsx)("span",{children:"\uD83D\uDDC4ï¸"})," Database Schema"]}),(0,a.jsx)("div",{className:"space-y-3",children:Object.entries(W.tables).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"border-2 rounded-lg p-3 transition-all ".concat(p===t?"border-pink-500 bg-pink-50":"border-gray-200"),children:[(0,a.jsxs)("h3",{className:"font-bold text-gray-900 mb-2 flex items-center gap-2",children:["\uD83D\uDCCA ",t,(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["(",s.sampleData.length," rows)"]})]}),(0,a.jsx)("div",{className:"space-y-1",children:s.columns.map(e=>(0,a.jsxs)("div",{className:"text-sm text-gray-600 font-mono flex items-center justify-between",children:[(0,a.jsxs)("span",{children:["⢠",e]}),(0,a.jsx)("span",{className:"text-xs text-gray-400",children:s.types[e]})]},e))})]},t)})})]}),k.length>0&&(0,a.jsxs)("div",{className:"bg-white rounded-2xl shadow-lg p-6 border border-gray-100",children:[(0,a.jsxs)("h2",{className:"text-lg font-bold text-gray-900 mb-4 flex items-center gap-2",children:[(0,a.jsx)("span",{children:"\uD83D\uDD50"})," Query History"]}),(0,a.jsx)("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:k.slice(0,10).map(e=>(0,a.jsxs)("button",{onClick:()=>J(e),className:"w-full text-left p-3 border-2 border-gray-200 rounded-lg hover:border-pink-300 hover:bg-pink-50 transition-all group",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,a.jsx)("span",{className:"text-xs text-gray-500",children:new Date(e.timestamp).toLocaleStr
1ing()}),(0,a.jsxs)("span",{className:"text-xs font-semibold text-pink-600",children:[e.resultCount," rows"]})]}),(0,a.jsx)("code",{className:"text-xs text-gray-700 block truncate font-mono group-hover:text-pink-700",children:e.sql})]},e.id))})]})]})]}),"templates"===t&&(0,a.jsxs)("div",{className:"max-w-5xl mx-auto",children:[(0,a.jsxs)("div",{className:"text-center mb-8",children:[(0,a.jsx)("h2",{className:"text-3xl font-bold text-gray-900 mb-3",children:"Query Templates"}),(0,a.jsx)("p",{className:"text-gray-600",children:"Start with proven SQL patterns for common use cases"})]}),Object.entries(m).map(e=>{let[t,s]=e,r=c[t];return(0,a.jsxs)("div",{className:"mb-12",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("span",{className:"text-4xl",children:r.icon}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-2xl font-bold text-gray-900",children:r.name}),(0,a.jsx)("p",{className:"text-gray-600",children:r.description})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:s.map((e,t)=>(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-lg p-6 border border-gray-100 hover:shadow-xl transition-all group",children:[(0,a.jsxs)("h4",{className:"font-bold text-gray-900 mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xl",children:"\uD83D\uDCA1"}),e.name]}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-3",children:e.description}),(0,a.jsx)("pre",{className:"bg-gray-900 text-green-400 p-3 rounded-lg text-xs font-mono mb-3 overflow-x-auto",children:e.sql}),(0,a.jsx)("button",{onClick:()=>P(e),className:"w-full px-4 py-2 bg-gradient-to-r from-pink-600 to-orange-500 text-white rounded-lg font-semibold hover:shadow-lg transition-all",children:"Use This Template â"})]},t))})]},t)})]}),"learning"===t&&(0,a.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,a.jsxs)("div",{className:"text-center mb-10",children:[(0,a.jsx)("h2",{className:"text-3xl font-bold text-gray-900 mb-3",children:"SQL Learning Path"}),(0,a.jsx)("p",{className:"text-gray-600 mb-6",children:"Master SQL step-by-step with interactive lessons"}),(0,a.jsxs)("div",{className:"max-w-md mx-auto bg-white rounded-full p-2 shadow-lg",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-sm mb-2 px-3",children:[(0,a.jsx)("span",{className:"font-semibold text-gray-700",children:"Your Progress"}),(0,a.jsxs)("span",{className:"font-bold text-pink-600",children:[z,"/",u.length]})]}),(0,a.jsx)("div",{className:"h-3 bg-gray-200 rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-gradient-to-r from-pink-600 to-orange-500 transition-all duration-700 rounded-full",style:{width:"".concat(z/u.length*100,"%")}})})]})]}),I?(0,a.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,a.jsx)("button",{onClick:()=>A(null),className:"mb-6 text-pink-600 hover:text-pink-700 font-medium flex items-center gap-2",children:"â Back to Lessons"}),(0,a.jsxs)("div",{className:"bg-white rounded-2xl shadow-2xl p-8 border border-gray-100",children:[(0,a.jsx)("div",{className:"flex items-start justify-between mb-6",children:(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("span",{className:"text-5xl",children:I.icon}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-3xl font-bold text-gray-900",children:I.title}),(0,a.jsxs)("div",{className:"flex items-center gap-3 mt-2",children:[(0,a.jsx)("span",{className:"text-sm px-3 py-1 rounded-full font-semibold ".concat("Beginner"===I.difficulty?"bg-green-100 text-green-700":"Intermediate"===I.difficulty?"bg-yellow-100 text-yellow-700":"bg-red-100 text-red-700"),children:I.difficulty}),(0,a.jsxs)("span",{className:"text-sm text-gray-500",children:["â±ï¸ ",I.estimatedTime]})]})]})]})}),(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsxs)("h3",{className:"font-bold text-gray-900 mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{children:"\uD83D\uDCDA"})," What you'll learn:"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:I.topics.map((e,t)=>(0,a.jsx)("span",{className:"px-3 py-1 bg-pink-100 text-pink-700 rounded-lg text-sm font-mono font-semibold",children:e},t))})]}),(0,a.jsxs)("div",{className:"bg-blue-50 border-l-4 border-blue-500 p-6 rounded-lg mb-6",children:[(0,a.jsxs)("h3",{className:"font-bold text-blue-900 mb-3 flex items-center gap-2",children:[(0,a.jsx)("span",{children:"\uD83D\uDCA1"})," Explanation"]}),(0,a.jsx)("p",{className:"text-blue-800 whitespace-pre-line leading-relaxed",children:I.explanation})]}),(0,a.jsxs)("div",{className:"bg-gradient-to-br from-gray-900 to-gray-800 rounded-xl p-6 mb-6",children:[(0,a.jsxs)("h3",{className:"text-lg font-bold text-white mb-3 flex items-center gap-2",children:[(0,a.jsx)("span",{children:"\uD83D\uDCDD"})," Example Query:"]}),(0,a.jsx)("pre",{className:"bg-black/40 p-4 rounded-lg overflow-x-auto backdrop-blur-sm",children:(0,a.jsx)("code",{className:"text-green-400 font-mono text-sm leading-relaxed",children:I.example})})]}),I.challenge&&(0,a.jsxs)("div",{className:"bg-orange-50 border-l-4 border-orange-500 p-6 rounded-lg mb-6",children:[(0,a.jsxs)("h3",{className:"font-bold text-orange-900 mb-3 flex items-center gap-2",children:[(0,a.jsx)("span",{children:"\uD83C\uDFAF"})," Challenge:"]}),(0,a.jsx)("p",{className:"text-orange-800 mb-3",children:I.challengeDesc}),(0,a.jsx)("pre",{className:"bg-orange-100 p-3 rounded-lg overflow-x-auto",children:(0,a.jsx)("code",{className:"text-orange-900 font-mono text-sm",children:I.challenge})})]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)("button",{onClick:()=>{O(I.example),s("builder"),setTimeout(()=>G(),100)},className:"flex-1 px-6 py-4 bg-gradient-to-r from-pink-600 to-orange-500 text-white rounded-xl font-bold hover:shadow-xl transition-all",children:"Try This Query in Builder â"}),!M[I.id]&&(0,a.jsx)("button",{onClick:()=>{V(I.id),alert("\uD83C\uDF89 Lesson completed! Great job!")},className:"px-6 py-4 bg-green-500 text-white rounded-xl font-bold hover:shadow-xl transition-all",children:"â Mark Complete"})]})]})]}):(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:u.map(e=>(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-lg p-6 border-2 transition-all hover:shadow-2xl cursor-pointer ".concat(M[e.id]?"border-green-500 bg-green-50":"border-gray-200 hover:border-pink-300"),onClick:()=>Q(e),children:[(0,a.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"text-3xl",children:e.icon}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"font-bold text-gray-900 text-lg",children:e.title}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,a.jsx)("span",{className:"text-xs px-2 py-1 rounded-full font-semibold ".concat("Beginner"===e.difficulty?"bg-green-100 text-green-700":"Intermediate"===e.difficulty?"bg-yellow-100 text-yellow-700":"bg-red-100 text-red-700"),children:e.difficulty}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["â±ï¸ ",e.estimatedTime]})]})]})]}),M[e.id]&&(0,a.jsx)("span",{className:"text-2xl",children:"â
"})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mb-3",children:e.topics.map((e,t)=>(0,a.jsx)("span",{className:"text-xs px-2 py-1 bg-gray-100 text-gray-700 rounded-md font-mono",children:e},t))}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:e.explanation.split("\n")[0]}),(0,a.jsxs)("button",{className:"w-full px-4 py-2 bg-gradient-to-r from-pink-600 to-orange-500 text-white rounded-lg font-semibold hover:shadow-lg transition-all",children:[M[e.id]?"Review Lesson":"Start Lesson"," â"]})]},e.id))})]}),(0,a.jsxs)("div",{className:"mt-20 p-10 rounded-2xl bg-gradient-to-br from-pink-600 to-orange-500 text-center shadow-2xl",children:[(0,a.jsx)("h2",{className:"text-3xl font-bold text-white mb-4",children:"Build Full-Stack Apps with Database Integration"}),(0,a.jsx)("p",{className:"text-orange-50 text-lg mb-8 max-w-2xl mx-auto",children:"NxCode AI automatically designs database schemas, generates SQL queries, and builds your entire backend. No SQL expertise needed."}),(0,a.jsx)("a",{href:"https://studio.nxcode.io?utm_source=nxcode_landing&utm_medium=web&utm_campaign=tools&utm_content=cta",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-8 py-4 rounded-xl bg-white text-pink-600 font-bold hover:bg-gray-50 transition-all shadow-xl hover:shadow-2xl transform hover:scale-105",children:"Try NxCode Free â"})]}),(0,a.jsx)(d.A,{currentSlug:"sql-query-builder"})]})})]})}}},e=>{var t=t=>e(e.s=t);e.O(0,[35526,90636,46593,38792],()=>t(21314)),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.